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
Explain high-order and low-order bytes.
Is c is a high level language?
What are data structures in c and how to use them?
Why is c fast?
What is the difference between array_name and &array_name?
show how link list can be used to repersent the following polynomial i) 5x+2
What is local and global variable in c?
what is the height of tree if leaf node is at level 3. please explain
What does printf does?
How can I run c program?
Explain what is page thrashing?
Can we replace the struct function in tree syntax with a union?
the real constant in c can be expressed in which of the following forms a) fractional form only b) exponential form only c) ascii form only d) both a and b
What is hungarian notation? Is it worthwhile?
Explain why can’t constant values be used to define an array’s initial size?