write a program in C to swap two variables
Answer Posted / senthil mca sns
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter the a value:");
scanf("%d",&a);
printf("Enter the b value:");
scanf("%d",&b);
b=a+b-(a=b);
printf("After Swapping a=%d,b=%d",a,b);
getch();
}
| Is This Answer Correct ? | 3 Yes | 2 No |
Post New Answer View All Answers
Explain the difference between #include "..." And #include <...> In c?
What are the different types of C instructions?
What is masking?
Create a simple code fragment that will swap the values of two variables num1 and num2.
Why we use break in c?
How do you determine the length of a string value that was stored in a variable?
What is difference between union and structure in c?
How many levels of pointers can you have?
what are # pragma staments?
What is a stream in c programming?
Which are low level languages?
How can I recover the file name given an open stream or file descriptor?
Tell me when would you use a pointer to a function?
What header files do I need in order to define the standard library functions I use?
what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values