Answer to Question #3349 in C++ for mukunda
Write a program to calculate the average marks of a student (Declare variables as global)?
1
2011-07-19T06:22:30-0400
#include <iostream>
using namespace std;
int marks[] = { 68, 34, 56, 80 };
const int marks_size = sizeof(marks) / sizeof(int);
int main()
{
double sum = 0;
for (int i = 0; i < marks_size; ++i)
& sum += marks[i];
double average = sum / marks_size;
cout << "Average mark is " << average << endl;
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!
Learn more about our help with Assignments:
C++
Comments
Leave a comment