Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- int main(){
- int input = 0;
- int gradeCount = 0;
- int gradeSum = 0;
- while (input >= 0) {
- std::cout << "Enter grade (-1 finish)\n";
- std::cin >> input;
- if (input > 0) {
- gradeCount++;
- gradeSum+=input;
- std::cout << "Grade " << input << "% added\n";
- }
- }
- std::cout << "Average GPA is " << gradeSum / gradeCount;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement