Answer to Question #39167 in C++ for prakash

Question #39167
wap to find out average temperature of the week.
1
Expert's answer
2017-03-27T10:03:07-0400
#include <iostream>

using namespace std;

const char* const days[]={"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"};

int main () {
int temperature = 0;
int i, t;

for ( i = 0; i < 7; i++) {
cout << "Enter temperature for "
<< days [i]
<< " :";
cin >> t;
temperature += t;
}
cout << "Average: "
<< temperature / 7;
<< 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
APPROVED BY CLIENTS