Answer:
The following code is in C++.
#include <iostream>
using namespace std;
int main() {
int a[10],sum=0;//declaring an array and initialized variable sum with value 0.
cout<<"Enter the numbers"<<endl;
for(int i=0;i<10;i++)
{
cin>>a[i]; //taking input of 10 integers.
}
for(int i=0;i<10;i++)
{
sum=sum+a[i];//finding the sum..
}
cout<<"The sum is : "<<sum<<endl<<"The numbers entered are "<<endl;
for(int i=0;i<10;i++)
{
cout<<a[i]<<" ";//displaying the elements.
}
return 0;
}
Output:-
Enter the numbers
1 2 3 4 5 6 7 8 9 10
The sum is : 55
The numbers entered are
1 2 3 4 5 6 7 8 9 10
Explanation:
I have taken an array of size 10 so that no more than 10 integers could fit in it.After that taking the input from the user prompting 10 integers using the for loop.After that finding the sum.Then printing the sum and the numbers entered.