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
Explain how can I prevent another program from modifying part of a file that I am modifying?
What is the general form of a C program?
What is a void * in c?
Explain what math functions are available for integers? For floating point?
What is pass by reference in functions?
What does the characters “r” and “w” mean when writing programs that will make use of files?
What is the use of putchar function?
What are operators in c?
In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none
How to draw the flowchart for structure programs?
How can I call a function with an argument list built up at run time?
In which layer of the network datastructure format change is done
Explain the difference between null pointer and void pointer.
Can we use any name in place of argv and argc as command line arguments?
What is the difference between procedural and functional programming?