Friday, 10 July 2015

Write C Program to Swap two numbers

1:  #include <stdio.h>  
2:  int main()  
3:  {  
4:    int x, y, temp;  
5:    printf("Enter the value of x and y\n");  
6:    scanf("%d%d", &x, &y);  
7:    printf("Before Swapping\nx = %d\ny = %d\n",x,y);  
8:    temp = x;  
9:    x  = y;  
10:    y  = temp;  
11:    printf("After Swapping\nx = %d\ny = %d\n",x,y);  
12:    return 0;  
13:  }  

No comments:

Post a Comment