write a program to swap two variables a=5 , b= 10 without
using third variable
Answer Posted / nagendra kumar
#include<stdio.h>
main(){
int a,b;
printf("Enter A value: ");
scanf("%d",&a);
printf("\nEnter B value: ");
scanf("%d",&b);
printf("\nThe value of A is:%d",a);
printf("\n The value of B is:%d",b);
a=(a+b)-(b=a);
printf("\n The value of A is:%d",a);
printf("\n The value of B is:%d",b);
}
| Is This Answer Correct ? | 4 Yes | 2 No |
Post New Answer View All Answers
Why is main function so important?
Can the size of an array be declared at runtime?
How can I implement sets or arrays of bits?
How the c program is executed?
Difference between strcpy() and memcpy() function?
The __________ attribute is used to announce variables based on definitions of columns in a table?
Explain how can you tell whether a program was compiled using c versus c++?
Explain the Difference between the New and Malloc keyword.
Differentiate between a structure and a union.
what is the function of pragma directive in c?
Suggesting that there can be 62 seconds in a minute?
Is c is a procedural language?
What is const and volatile in c?
Describe the header file and its usage in c programming?
What is difference between union and structure in c?