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. Required fields are marked *

Shopping Basket
Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare
Verified by MonsterInsights