how to swap four numbers without using fifth variable?
Answer Posted / rocky
#include<stdio.h>
void main()
{
int a,b,c,d;
printf("enter values
");
scanf("%d %d %d %d",&a,&b,&c,&d);
printf("before swapping
");
printf("%d %d %d %d",a,b,c,d);
a=(a+d);
d=(a-d);
a=(a-d);
c=(c+b);
b=(c-b);
c=(c-b);
printf("after swapping:%d %d %d %d",a,b,c,d);
}
| Is This Answer Correct ? | 5 Yes | 5 No |
Post New Answer View All Answers
What is size of union in c?
Is the exit() function same as the return statement? Explain.
What is the use of function overloading in C?
Is r written in c?
What is difference between arrays and pointers?
Implement bit Array in C.
How does free() know explain how much memory to release?
Differentiate between full, complete & perfect binary trees.
What does %p mean c?
the constant value in the case label is followed by a a) semicolon b) colon c) braces d) none of the above
What is meant by recursion?
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant
What is the difference between array and pointer in c?
What is "Hungarian Notation"?
Write a C program in Fibonacci series.