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
Device an algorithm for weiler-atherton polygon clipping, where the clipping window can be any specified polygon
1) There is a singing competition for children going to be conducted at a local club. Parents have been asked to arrive at least an hour before and register their children’s names with the Program Manager. Whenever a participant registers, the Program Manager has to position the name of the person in a list in alphabet order. Write a program to help the Program Manager do this by placing the name in the right place each time the Program Manger enters a name. 2) the Event Manager has to send participants to the stage to perform in the order in which they registered. Write a program that will help the Event Manager know who to call to the stage to perform. The Logic should be in Data Structures
Tell me with an example the self-referential structure?
How can you return multiple values from a function?
Why array is used in c?
Why is void main used?
How the c program is executed?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
Give the rules for variable declaration?
what is the role you expect in software industry?
Should a function contain a return statement if it does not return a value?
Where is c used?
What is maximum size of array in c?
What is malloc return c?
What does the message "automatic aggregate intialization is an ansi feature" mean?