顺序和选择程序设计.pptVIP

  • 1
  • 0
  • 约7.91千字
  • 约 36页
  • 2017-12-13 发布于江苏
  • 举报
顺序和选择程序设计

if (fabs(disc)=1e-6) printf(“has two equal roots: %8.4\n”,-b/(2*a)); else if (disc1e -6) { x1=(-b+sqrt(disc))/(2*a); x2=(-b-sqrt(disc))/(2*a); printf (“has distinct real roots: %8.4f and %8.4f\n”,x1,x2);} else {realpart=-b/(2*a); imagpart=sqrt(-disc)/(2*a); printf (“has complex roots:\n”); printf (%8.4f+%8.4fi\n”,realpart,imagpart); printf (%8.4f-%8.4fi\n”,realpart,imagpart); } } } 例10 按所输入的年份year和月份month,计算该月有多少天。 需判断该年是否为闰年:闰年的2月有29天,平年的2月只有28天。 闰年的条件是年份数year符合下面二者之一: ?能被4整除,

文档评论(0)

1亿VIP精品文档

相关文档