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
An organised method of depicting the use of an area of computer memory used to signify the uses for different parts of the memory a) swap b) extended memory c) memory map d) all of the above
Are local variables initialized to zero by default in c?
Is there anything like an ifdef for typedefs?
What are the 4 data types?
What is the size of enum in bytes?
When should structures be passed by values or by references?
"C" language developed by "Dennis Ritchie" at AT & T. his remarks are a) too general, too abstract b) could deal with only specific problems c) lost generality of BCPL and B restored d) no remarks
Do character constants represent numerical values?
write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare. You will then tabulate this information in another file.
What is volatile c?
How pointers are declared?
Explain about block scope in c?
Describe explain how arrays can be passed to a user defined function
what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)
What are # preprocessor operator in c?