fork download
  1. #include <iostream>
  2. using namespace std;
  3. int main() {
  4. int age1, age2, age3, age4, age5, age6, age7, age8, age9, age10;
  5. int TotalAge, AverageAge;
  6. cout << "Please enter age of student 1: ";
  7. cin >> age1;
  8. cout << "Please enter age of student 2: ";
  9. cin >> age2;
  10. cout << "Please enter age of student 3: ";
  11. cin >> age3;
  12. cout << "Please enter age of student 4: ";
  13. cin >> age4;
  14. cout << "Please enter age of student 5: ";
  15. cin >> age5;
  16. cout << "Please enter age of student 6: ";
  17. cin >> age6;
  18. cout << "Please enter age of student 7: ";
  19. cin >> age7;
  20. cout << "Please enter age of student 8: ";
  21. cin >> age8;
  22. cout << "Please enter age of student 9: ";
  23. cin >> age9;
  24. cout << "Please enter age of student 10: ";
  25. cin >> age10;
  26. TotalAge = age1 + age2 + age3 + age4 + age5 + age6 + age7 + age8 + age9 + age10;
  27. AverageAge = TotalAge / 10;
  28. cout << "Average Age is: " << AverageAge;
  29. return 0;
  30. }
Success #stdin #stdout 0s 544KB
stdin
Standard input is empty
stdout
Please enter age of student 1: Please enter age of student 2: Please enter age of student 3: Please enter age of student 4: Please enter age of student 5: Please enter age of student 6: Please enter age of student 7: Please enter age of student 8: Please enter age of student 9: Please enter age of student 10: Average Age is: -23613672