C Program to Swapping Between Three Numbers

Sure, swapping three numbers involves exchanging the values of three variables. The basic idea is to use a temporary variable to hold the value of one of the variables while you perform the swaps. Here’s a simple C program that demonstrates swapping between three numbers:

Program :

#include<stdio.h>
#include<conio.h>
main()
{
int a,b,c,temp;
printf(“Enter the First Number : “);
scanf(“%d”,&a);
printf(“Enter the Second Number : “);
scanf(“%d”,&b);
printf(“Enter the Third Number : “);
scanf(“%d”,&c);
temp=a;
a=b;
b=c;
c=temp;
printf(“\nAfter Swapping…\nFirst Number : %d”,a);
printf(“\nSecond Number : %d”,b);
printf(“\nTrird Number : %d”,c);
}

Output :

Leave a Comment

Your email address will not be published.

Shopping Basket
Verified by MonsterInsights