0% found this document useful (0 votes)
70 views

Array Summation

This C++ program defines two arrays called first and second that can each hold 20 integers. It prompts the user to enter the number of elements for the arrays, and then separately inputs values for each array. The program then outputs the sum of each corresponding element from the two arrays.

Uploaded by

Pramit Dutta
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views

Array Summation

This C++ program defines two arrays called first and second that can each hold 20 integers. It prompts the user to enter the number of elements for the arrays, and then separately inputs values for each array. The program then outputs the sum of each corresponding element from the two arrays.

Uploaded by

Pramit Dutta
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include<iostream>

using namespace std;



main()
{
int first[20], second[20], c, n;

cout << "Enter the number of elements in the array ";
cin >> n;

cout << "Enter elements of first array " << endl;

for ( c = 0 ; c < n ; c++ )
cin >> first[c];

cout << "Enter elements of second array " << endl;

for ( c = 0 ; c < n ; c++ )
cin >> second[c];

cout << "Sum of elements of two arrays " << endl;

for ( c = 0 ; c < n ; c++ )
cout << first[c] + second[c] << endl;

return 0;
}

You might also like