Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

exchange the value of two variables

// WRITE A C PROGRAM TO EXCHANGE THE VALUE OF TWO VARIABLES

#include  <stdio.h>
void main()
{
    int x,y,temp;
    printf("enter  the value of x and y\n");
    scanf("%d %d",&x,&y);

    printf("x = %d y = %d\n",x,y);
   
    // exchange the value of two variables

    temp=x;

    x=y;

    y=temp;

    printf("x = %d y = %d\n",x,y);
}

Post a Comment

0 Comments