Monday, May 23, 2016

Cprogram for swapping two numbers using temporary variable

Program
 #include<stdio.h>
main()
{
int a,b,t;
printf("enter two numbers:\n");
scanf("%d%d",&a,&b);
t=a;
a=b;
b=t;
printf("swap values are %d and %d",a,b);
}

Output
enter two numbers:
5 6
swap values are 6 and 5

No comments:

Post a Comment