赞
踩
#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("Nember of failures = %d\n",count); return 0; }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。