Answer to Question #14272 in C++ for yantra

Question #14272
c++ program to take average of 6 subjects
1
Expert's answer
2012-09-07T10:24:31-0400
#include <iostream>

using std::cin;

int main() {
int i, n;
double temp, sum=0.0;
cin >> n;

for (i=0; i<n; ++i) {
std::cout << "Enter the mark of subject "<<(i+1) << std::endl;
cin >> temp;
sum += temp;
}

std::cout << (sum / n) << std::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!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS