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-b;
a=a-b;
printf("\n The value of A is:%d",a);
printf("\n The value of B is:%d",b);
}
| Is This Answer Correct ? | 20 Yes | 4 No |
Post New Answer View All Answers
Do you know pointer in c?
Why c is called top down?
Explain what happens if you free a pointer twice?
How to declare pointer variables?
Is javascript based on c?
What does main () mean in c?
What is the use of extern in c?
What is the package for freshers(Non IIT) in amazon(hyderabad). And what is the same for those who are a contract employee.
Write a program to check prime number in c programming?
Is it better to bitshift a value than to multiply by 2?
How are 16- and 32-bit numbers stored?
What is clrscr in c?
Explain the properties of union. What is the size of a union variable
Can we change the value of #define in c?
main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }