How To Carry Out Swapping of Two Numbers in C Language?

 
#Include<stdio.h>
#include<conio.h>

Void main()

{              int a,b,;
               clrscr();
               Printf(“enter first no :”); /*user will define the value*/
               Scanf(“%d”&a);
               Printf(“enter second first no :”);
               Scanf(“%d”&b); /*user will define the value*/
               a=a+b;
               b=a-b;
               a=a-b;
               printf(“%d”,a);
               prinf(“%d”,b);

getch();

}

Output:

Enter first no : 10
Enter Second no :20
a=20
b=10

Post a Comment

0 Comments

Ad Code

Responsive Advertisement