正在加载图片...
include <stdio,h> int main(void) 源程序-统计成绩 i int count, i double grade, total printf(" Enter n: ) scanf( %d",&n) total =o: count =0: for(i=1; i<=n; i++r Enter n: 4 Enter grade 1: 67 printf(" enter grade #%d: ,i) Enter grade #2: 54 scanf( %If",&grade); Enter grade #3: 88 total total t grade; Enter grade # 4: 73 if(grade 60) Grade average=70.50 count++ 此处省略 else Number of failures=1 printf(" Grade average =%.2fn", total/n) printf(" number of failures=%din", count return 0:#include <stdio.h> int main(void) { int count, i, n; double grade, total; printf("Enter n: "); scanf("%d", &n); total = 0; count = 0; for(i = 1; i <= n; i++){ printf("Enter grade #%d: ", i); scanf ("%lf", &grade); total = total + grade; if(grade < 60) count++; } printf("Grade average = %.2f\n", total/n); printf("Number of failures = %d\n", count); return 0; } 源程序-统计成绩 Enter n: 4 Enter grade #1: 67 Enter grade #2: 54 Enter grade #3: 88 Enter grade #4: 73 Grade average = 70.50 此处省略else Number of failures = 1
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有