Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » C++ » Solved Programs » Display the sum of 10 numbers

C++ console application that will display the sum of 10 numbers

#include <iostream>
using namespace std;

int main(){
    int arr[10];
    int sum = 0;
    
    for(int i=0; i<10; i++){
        cout<<"\n Enter ["<<i<<"] : ";
        cin>>arr[i];
        sum += arr[i];
    }
    
    cout<<"\n Sum of 10 number is : "<<sum;
    
    return 0;
}


Sum of 10 numbers in C++

C++ code to print sum of 10 numbers