Powered By Blogger

21 February 2017

PROGRAM TO PRINT SUM OF 10 NUMBERS

INPUT=


 #include<iostream>
using namespace std;
int main()
{
int a[10],i,sum;
        sum=0;
        cout<<"Enter 10 elements";
        for(i=0;i<10;i++)
        {
              cin>>a[i];
              sum=sum+a[i];
        }
        cout<<"The sum is ="<<sum;
        return 0;
}

OUTPUT=

Enter 10 elements
0
2
3
4
5
6
7
8
9
10

The sum is = 54

No comments:

Post a Comment