Write a C-program to print swaping of two numbers with using third variable?

Write a C-program to print swaping of two numbers with using third variable


#include <stdio.h>
                                                                         
int main() {
    int x,y,z;
    printf("Enter x,y values");
    scanf("%d%d",&x,&y);
    printf("Before Swapping x value is  %d",x);
    printf("\nBefore Swapping y value is  %d",y);
    z=x;
    x=y;
    y=z;
    printf("\n\nAfter Swapping x value is  %d",x);
    printf("\nAfter Swapping y value is  %d",y);
  
    return 0;
}
                                            

Output:

Enter x,y values10 20
Before Swapping x value is 10
Before Swapping y value is 20

After Swapping x value is 20
After Swapping y value is 10




More Programs


12 . Write a C-program to print swaping of two numbers with using third variable
13 . Write a C-program to print swaping of two numbers without using third variable
14 . Write a C-program to print relation of two numbers
15 . Write a C-program to print logical operators program using &&, || ,!
16 . Write a C-program to print bitwise AND operation
17 . Write a C-program to print bitwise OR operation
18 . Write a C-program to print bitwise CAP operation
19 . Write a C-program to print bitwise NEGATION operation
20 . Write a C-program to print bitwise LEFT SHIFT operation
21 . Write a C-program to print bitwise RIGHT SHIFT operation
22 . Write a C-program to print odd or even number using ternary operator