C program to swap two numbers - With Output

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

void main()
{
     int num1,num2,temp;
     printf(“Enter any two numbers\n”);
scanf(”%d%d”,&num1,&num2);
printf(“Numbers before swaping are : %d and %d”,num1,num2);

temp=num1;
num1=num2;
num2=temp;

printf(“Numbers after swaping are : %d and %d”,num1,num2);

getch();

}

OUTPUT:

Enter any two numbers
12 43
Numbers before swaping are : 12 and 43

Numbers after swaping are : 43 and 12
Share on Google Plus

About Akash Manhas

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment