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
List some basic data types in c?
When do we get logical errors?
Explain what is page thrashing?
What is the correct code to have following output in c using nested for loop?
what is reason of your company position's in india no. 1.
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
why programs in c are running with out #include
Not all reserved words are written in lowercase. TRUE or FALSE?
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
What is pointers in c with example?
Why double pointer is used in c?
Subtract Two Number Without Using Subtraction Operator
Differentiate between #include<...> and #include '...'
How does normalization of huge pointer works?
To print the pattern 1 2 3 4 5 10 17 18 19 6 15 24 25 20 7 14 23 22 21 8 13 12 11 10 9