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 does a pointer variable always consist of?
What is break statement?
State the difference between realloc and free.
What is the basic structure of c?
What is the condition that is applied with ?: Operator?
How do you use a pointer to a function?
Can we initialize extern variable in c?
Describe the difference between = and == symbols in c programming?
main() { printf("hello"); fork(); }
Where is volatile variable stored?
What are identifiers and keywords in c?
Is c procedural or functional?
What do you mean by a sequential access file?
What is the difference between single charater constant and string constant?
What is the use of sizeof () in c?