Saturday, 29 November 2014

Create two arrays of 10 elements each and then subtract them and store the result in the third array. Print third array.

Leave a Comment
Code:-

#include<iostream>
using namespace std;
void main()
{
int arr1[10]={3,3,3,3,3,3,3,3,3,3},arr2[10]={4,4,4,4,4,4,4,4,4,4},result[10]={0};
for(int i=0;i<10;i++)
{
result[i]=arr2[i]-arr1[i];
}
for(int j=0;j<10;j++)
{
cout<<result[j]<<endl;
}

}

Output

If You Enjoyed This, Take 5 Seconds To Share It

0 Questions: