C++ Program to take random numbers from user and calculate their sum

Program:

#include<iostream>
using namespace std;
int main()
{
int arr[10], sum=0;
for(int a=0; a<=9; a++)
{
cout<<"Enter Random Number:";
cin>>arr[a];
}
cout<<"\n\n\nPrint Random Numbers Entered by User....";
for(int a=0; a<=9; a++)
{
cout<<endl<<arr[a];
}
for(int a=0; a<=9; a++)
{
sum=sum+arr[a];
}
cout<<"\n\n\nSum of Random Numbers........";
cout<<"\nSum of Random Numbers is: "<<sum;
return 0;
}

Output:



Comments