Skip to main content

Q.2 Write a program to swap the content of two variables in c.

 #include<stdio.h>

int main()
{

int a,b,c;
printf(“Enter the value of a=”);
scanf(“%d”,&a);

printf(“Enter the value of b=”);
scanf(“%d”,&b);

c=a;
a=b;

printf(“\n The new value of a=%d\n”,a);
printf(“\n The new value of b=%d\n”,c);

}


Comments

Popular posts from this blog

How to compare two strings in C?

 

How to output a string in C ?

 

How to reverse a string in C?