Swaping Values of a and b : C Programs
#include <stdio.h>
#include<conio.h>
void main()
{
int a, b,temp;
a=5;
b=10;
printf("First Values Are %d %d",a,b);
temp = a; /* Value of a is stored in variable temp */
a = b; /* Value of b is stored in variable a */
b = temp; /* Value of temp(which contains initial value of a) is stored in variable b*/
printf("\nAfter swapping, value are %d %d",a,b);
getch();
}
0 comments:
Post a Comment