#include<iostream.h>
#include<conio.h>
void main()
{
 int x[5]={1,2,3,4,5},y[5]={5,4,3,2,1},result [5]={0,0,0,0,0};
 int i=0;
 while(i++ <5)
  result[i]=x[i]-y[i];
 clrscr();
 cout<<"\nThe contents of the array are :\n";
 i=0;
 do
 {
    cout<<'\t'<<x[i]<<'\t'<<y[i]<<'\t'<<result [i]<<"\n";
 i++;
}while(i<5);
getch();
}

OUTPUT:

The contents of the array are:

1 -1 0
2 4 -2
3 3 0
4 2 2
5 1 4
GIVE ME THE EXPLANATION FOR THIS OUTPUT.
e-mail to <EMAIL SNIPPED>

Ezzaral commented: So lame. -2

the output you posted is wrong. Here is the correct output. Had you bothered to compile and run that program you would have seen it too.

The contents of the array are :
        1       5       0
        2       4       -2
        3       3       0
        4       2       2
        5       1       4
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.