//Program to swap two numbers using 3rd number
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, c;
clrscr();
printf("Enter two integers values\n");
scanf("%d%d", &a, &b);
// let a = 11, b = 13
printf("The numbers before swapping are\n");
// Printing of a = 11 and b = 13
printf("1st Number = %d\n2nd Number = %d\n\n",a,b);
c = a ; // c = 11
a = b ; // a = 13
b = c ; // b = 11
printf("The numbers after swapping are\n");
//Printing of a = 13 and b = 11
printf("1st Number = %d\n2nd Number = %d",a,b);
getch();
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.