2dix-The Student Choice
Log in Register now

C++ Program of SWAPING OF TWO ARRAYS

Write a Program of SWAPING OF TWO ARRAYS

#include<iostream.h> 
#include<conio.h> 

void main()
{
int a[10],b[10],c[10],i;
clrscr();
printf("Enter First array->");
for(i=0;i<10;i++)
scanf("%d",&a[i]);
printf("\nEnter Second array->");
for(i=0;i<10;i++)
scanf("%d",&b[i]);
printf("Arrays before swapping");
printf("\nFirst array->");
for(i=0;i<10;i++)
{
printf("%d",a[i]);
}
printf("\nSecond array->");
for(i=0;i<10;i++)
{
printf("%d",b[i]);
}
for(i=0;i<10;i++)
{
//write any swapping technique
c[i]=a[i];
a[i]=b[i];
b[i]=c[i];
}
printf("\nArrays after swapping");
printf("\nFirst array->");
for(i=0;i<10;i++)
{
printf("%d",a[i]);
}
printf("\nSecond array->");
for(i=0;i<10;i++)
{
printf("%d",b[i]);
}
getch();
}

Note:
      If you want to change in this program please write through the comment on this page. you can also past similar program 
                 of c++ with output.your comment is valuable to the other user and person.

comments (1)

avatar