how to swap four numbers without using fifth variable?
Answer Posted / srinija jilugu
#include<stdio.h>
void main()
{
int a,b,c,d;
printf("enter values\n");
scanf("%d %d %d %d",&a,&b,&c,&d);
printf("before swapping\n");
printf("%d %d %d %d",a,b,c,d);
a=(a+b);
b=(a-b);
a=(a-b);
c=(c+d);
d=(c-d);
c=(c-d);
printf("after swapping:%d %d %d %d",&a,&b,&c,&d);
}
| Is This Answer Correct ? | 23 Yes | 19 No |
Post New Answer View All Answers
What is self-referential structure in c programming?
Tell me what are bitwise shift operators?
What is operator precedence?
What is indirection?
Tell us two differences between new () and malloc ()?
write a c program to find the sum of five entered numbers using an array named number
What is the use of sizeof () in c?
How can I call a function with an argument list built up at run time?
What does 2n 4c mean?
Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)
in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none
What is #include stdlib h?
Which is the memory area not included in C program? give the reason
What would happen to X in this expression: X += 15; (assuming the value of X is 5)
What is the difference between ++a and a++?