Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding two array in c++ #381

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions adding two array in array
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include<iostream>
using namespace std;
int main()
{
int first[20], second[20], sum[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 the arrays:" << endl;

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