//Andres Guzman CSC5 Chapter 3, P. 143, #3
//
/**************************************************************
*
* FIND THE TEST AVERAGE
* ____________________________________________________________
* This program computes the average amongst 5 tests
*
* Computation is based on the formula:
* sum = test1 + test2 + test3 +test4 + test5
* average = sum / 5
* ____________________________________________________________
* INPUT
* test1 :test score
* test2 :test score
* test3 :test score
* test4 :test score
* test5 :test score
* OUTPUT
* sum : total score of all tests
* average = average of all tests
**************************************************************/
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
using namespace std;
int main ()
{
int test1, test2, test3, test4, test5;
//
//Output results
cout << "The score from test 1: ";
cin >> test1;
cout << "\nThe score from test 2: ";
cin >> test2;
cout << "\nThe score from test 3: ";
cin >> test3;
cout << "\nThe score from test 4: ";
cin >> test4;
cout << "\nThe score from test 5: ";
cin >> test5;
//
//
int sum = test1 + test2 + test3 + test4 + test5;
float average = sum / 5;
cout << "\nThe average amonst the tests: ";
cout << fixed << setprecision(1) << average << endl;
return 0;
}
Ly9BbmRyZXMgR3V6bWFuIENTQzUgQ2hhcHRlciAzLCBQLiAxNDMsICMzCi8vCi8qKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKioqKgoqCiogRklORCBUSEUgVEVTVCBBVkVSQUdFCiogX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fCiogVGhpcyBwcm9ncmFtIGNvbXB1dGVzIHRoZSBhdmVyYWdlIGFtb25nc3QgNSB0ZXN0cwoqCiogQ29tcHV0YXRpb24gaXMgYmFzZWQgb24gdGhlIGZvcm11bGE6Ciogc3VtID0gdGVzdDEgKyB0ZXN0MiArIHRlc3QzICt0ZXN0NCArIHRlc3Q1CiogYXZlcmFnZSA9IHN1bSAvIDUKKiBfX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KKiBJTlBVVAoqIHRlc3QxIDp0ZXN0IHNjb3JlC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