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 are the advantage of c language?
Explain what is the advantage of a random access file?
write a program to display all prime numbers
A collection of functions,calls,subroutines or other data a) library b) header files c) set of files d) textfiles
What is hash table in c?
What are the types of i/o functions?
What are header files in c programming?
what is a function method?give example?
When is a null pointer used?
How will you declare an array of three function pointers where each function receives two ints and returns a float?
Why clrscr is used after variable declaration?
Differentiate between calloc and malloc.
What are actual arguments?
what are the facialities provided by you after the selection of the student.
how logic is used