Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********************************************
- Name: Alexander Diaz
- Panther ID: 3840829
- Assignment: Homework 2
- Write a C++ program to calculate the average
- grades of 20 students in a class. Each student
- takes 5 exams and the average grade is calculated
- as the average of all the 5 exams. The program must
- ask the user to input grades for each student, calculate
- the average grade and display the output.
- ********************************************/
- #include <iostream>
- #include <math.h>
- using namespace std;
- int main()
- {
- float e1, e2, e3, e4, e5;
- int student;
- for (student = 1; student <= 20; student++)
- {
- cout << "Please enter the five exams grades for student" student;
- cin >> e1;
- cin >> e2;
- cin >> e3;
- cin >> e4;
- cin >> e5;
- cout << "Average grade is " (e1 + e2 + e3 + e4 + e5) / 2;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement