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

Write a program in java to print your basic information.

 

Write a program in java to swap two numbers without using third variable.

 

How to convert a string to uppercase in C?