write a program in C to swap two variables

Answer Posted / anju

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,temp;
scanf("%d%d",&a,&b);
printf("before swapping value of a=%d and b=%d",a,b);
temp=x;
x=y;
y=temp;
printf("after swapping value of a=%d and b=%d",a,b);
getch();
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the meaning of typedef struct in c?

803


What is the argument of a function in c?

776


What is actual argument?

815


Do you know pointer in c?

802


to print the salary of an employee according to follwing calculation: Allowances:HRA-20% of BASIC,DA-45% of BASIC,TA-10%. Deductions:EPF-8% of BASIC,LIC-Rs.200/-Prof.Tax:Rs.200/- create c language program?

1831


What is the difference between ‘g’ and “g” in C?

3415


How do you sort filenames in a directory?

941


What is #include stdio h?

898


What happens if you free a pointer twice?

804


Are negative numbers true in c?

774


why do some people write if(0 == x) instead of if(x == 0)?

831


How many levels deep can include files be nested?

869


Who developed c language and when?

820


Is c programming hard?

769


write a c program to find the largest and 2nd largest numbers from the given n numbers without using arrays

1988