Swap two number with customer choice
Swap two number with customer choice in C language.
#include<stdio.h>
void swap(int,int);
int main()
{
int a,b;
printf("Enter first number: ");
scanf("%d", &a);
printf("Enter second number: ");
scanf("%d", &b);
swap(a,b);
}
void swap(a,b)
{
int temp = a;
a = b;
b = temp;
printf("After swapping, firstNumber = %d\n", a);
printf("After swapping, secondNumber = %d", b);
}
Output program
Thank You.
Comments
Post a Comment