Answer to Question #42235 in C++ for Yazid abubakar

Question #42235
write a c program that accept 10 student grade a calculate their average using microsoft visual c++
1
Expert's answer
2014-05-14T09:22:48-0400
#include <stdio.h>
#include <stdlib.h>
//main function
int main(int argc, char *argv[])
{
//variable for average
double average;
//variable for sum
double sum=0;
//variable for grade
double grade;
int i;
//promt user to enter grade
for( i=0;i<10;i++){
printf("Enter grade fro student %d: ",(i+1));
scanf("%lf",&grade);//read grade from keyboard
sum+=grade;//calculate sum
}
//calculate average
average=sum/10;
//show average
printf("Average = %.2lf\n\n",average);
//delay
system("PAUSE");
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS