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 pass by reference in functions?

320


What is optimization in c?

562


How can I read/write structures from/to data files?

544


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

916


What is substring in c?

634






What is the scope of global variable in c?

551


How to implement a packet in C

2391


When is the “void” keyword used in a function?

826


Why can’t we compare structures?

806


"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks

652


What is a string?

664


What is the use of #define preprocessor in c?

613


What is union and structure?

569


What is ambagious result in C? explain with an example.

2051


What is the difference between arrays and pointers?

629