Write a program for the addition of two arrays

//this is a program for the addition of two arrays
#include<iostream>
#include<conio.h>

using namespace std;

int main()
{
int a[5],b[5],c[5],i;

cout<<"\n\nAccepting the array Elements: ";

cout<<"\n\nEnter the elements of array A: ";
for(i=0;i<5;i++)
cin>>a[i];

cout<<"\n\nEnter the elements of array B: ";
for(i=0;i<5;i++)
cin>>b[i];

//Performing addition

for(i=0;i<5;i++)
{
c[i]=a[i]+b[i];
}

cout<<"\n\nDisplaying the addition of arrays A and B in Array C: ";

for(i=0;i<5;i++)
cout<<" "<<c[i];

getch();


}

Previous
Next Post »