To write a C++ program to read five integer elements into an array and find their sum
/**************************************************************************************************** Purpose : To write a C++ program to read five integer elements into an array and find their sum. *****************************************************************************************************/ #include <iostream> using namespace std; int main() { int A[5]; int sum=0; cout<<"Enter the array elements :"<<endl; for(int i=0; i<5; i++) { cin>> A[i]; } for(int i=0; i<5; i++) { sum = sum + A[i]; } cout << "The sum of the elements is :" <<sum<<endl; return 0; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)