Infolinks - Earn Easy Money

Saturday, April 4, 2015

C++ program to change the values of integers of second array according to first array.

#include <iostream>
using namespace std ;
int main ( )
{
int A [ 5 ] , B [ 5 ] ;
for ( int i = 0 ; i < 5 ; i++ )
{
cout << " Enter a number in 1st loop : " << endl ;
cin >> A [ i ] ;
}
for ( int i = 0 ; i < 5 ; i++ )
{
cout << " Enter a number in Second loop : " << endl ;
cin >> B [ i ] ;
}
B [ 0 ] = A [ 0 ];
for ( int i = 0 ; i < 5 ; i++ )
{
B [ 0 ] = A [ i ] + B [ i - 1 ];
 cout << B [ 5 ];
}
return 0 ;
}

No comments:

Post a Comment

Must drop your comments about post.