fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. // Marks scored by Aman in 5 subjects
  6. int marks[] = {85, 78, 92, 74, 88};
  7. int totalMarks = 0;
  8.  
  9. // Calculate the sum
  10. for (int i = 0; i < 5; i++) {
  11. totalMarks += marks[i];
  12. }
  13.  
  14. cout << "Total marks scored by Aman: " << totalMarks << endl;
  15.  
  16. return 0;
  17. }
Success #stdin #stdout 0s 5332KB
stdin
Standard input is empty
stdout
Total marks scored by Aman: 417