7 Write a program that takes 7 numbers from the user puts th
Solution
Solution.cpp
#include <iostream>//header for input output function
using namespace std;//it tells the compiler to link std namespace
int main()
{//main function
int arr[7],total=0;
cout<<\"Enter the 7 numbers :\"<<endl;
for(int i=0;i<7;i++)
{//for loop for inputting array values from the user
cout<<\"Enter \"<<(i+1)<<\"array elements :\";
cin>>arr[i];
total=total+arr[i];
}
cout<<\"Array elements are :\"<<endl;
for(int i=0;i<7;i++)
{//display array elements
cout<<arr[i]<<\"\\t\";
}
cout<<\"sum of array elements are :\";
cout<<total;
}
output
Enter the 7 numbers :
Enter 1array elements :50
Enter 2array elements :50
Enter 3array elements :50
Enter 4array elements :50
Enter 5array elements :50
Enter 6array elements :50
Enter 7array elements :50
Array elements are :
50 50 50 50 50 50 50
sum of array elements are :350
