Swapping Operation using third variable :-

QUESTION: Swapping operation using third variable (temp) 

#include <stdio.h>

int main ()

{

int a, b, temp;//a=10,b=20
printf ("enter the value of a &b "); // to print the output

scanf ("%d%d",&a,&b); // to take the input from the user
temp=a; //temp=10

a=b; //10=20

b=temp; //b=10, now a=30-b=30-10=20

printf ("after swapping a =%d and after swapping b=%d \n",a,b);

return 0;

}

INPUT :


OUTPUT:




                                                                               ---THANK YOU FOR VISITING THIS PAGE 























Comments

Post a Comment

Popular posts from this blog

Draw Messi sketch using python :-

create spotify logo in python -