write a program to swap two variables a=5 , b= 10 without
using third variable
Answer Posted / dhanalakshmi
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("enter the a value"));
scanf("%d",&a);//a=10
printf("enter the b value");
scanf("%d",&b);//b=5
b=b+a;
a=b-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 ? | 7 Yes | 2 No |
Post New Answer View All Answers
What are different types of pointers?
Can we compile a program without main() function?
if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above
In which header file is the null macro defined?
Define C in your own Language.
What does c mean in basketball?
What is quick sort in c?
How does selection sort work in c?
How reliable are floating-point comparisons?
What is variable declaration and definition in c?
What are volatile variables in c?
What does it mean when a pointer is used in an if statement?
Why clrscr is used in c?
How can you determine the maximum value that a numeric variable can hold?
What is the difference between fread buffer() and fwrite buffer()?