Monday, 25 March 2013

C++ adding first five location of two arrays

#include<iostream.h>
#include<conio.h>
void main(){ clrscr();
int a[5],b[5];  cout<<"Enter first 5 numbers = ";
for(int i=0;i<5;i++){
cin>>a[i]; }  cout<<"Enter Second 5 numbers = ";
for(int j=0;j<5;j++){
cin>>b[j]; } int s[5];
for(int x=0;x<5;x++){
s[x]=a[x]+b[x];
cout<<a[x]<<" + "<<b[x]<<" = "<<s[x]<<endl;
} getch();
}