Program 7: Accept two integer from the user and interchange them display interchange number. #include<stdio.h> void main()...

C Program to swap/interchange two numbers.





Program 7: Accept two integer from the user and interchange them display interchange number.
#include<stdio.h>
void main()
{
int x,y,temp;
printf("Enter two numbers to interchange:");
scanf("%d%d",&x,&y);
temp=x;
x=y;
y=temp;
printf("\nInterchanged numbers are %d and %d",x,y);
}

Output
[root@dhcppc16 ~]# cd ~/Desktop
[root@dhcppc16 Desktop]# gcc tm.c
[root@dhcppc16 Desktop]# ./a.out
Enter two numbers to interchange:9 12
Interchanged numbers are 12 and 9


0 coment�rios:

HTML5 CSS3 TUTORIAL FOR BEGINNERS