how to swap four numbers without using fifth variable?
Answer Posted / rocky
#include<stdio.h>
void main()
{
int a,b,c,d;
printf("enter values
");
scanf("%d %d %d %d",&a,&b,&c,&d);
printf("before swapping
");
printf("%d %d %d %d",a,b,c,d);
a=(a+d);
d=(a-d);
a=(a-d);
c=(c+b);
b=(c-b);
c=(c-b);
printf("after swapping:%d %d %d %d",a,b,c,d);
}
Is This Answer Correct ? | 5 Yes | 5 No |
Post New Answer View All Answers
Explain how can you tell whether two strings are the same?
Who invented bcpl language?
What are predefined functions in c?
Explain how can I open a file so that other programs can update it at the same time?
#include
How old is c programming language?
What is the mean of function?
How do you determine a file’s attributes?
What is the use of f in c?
Is linux written in c?
What are the different file extensions involved when programming in C?
What does c mean before a date?
hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm
#include main() { int *p, *c, i; i = 5; p = (int*) (malloc(sizeof(i))); printf(" %d",*p); *p = 10; printf(" %d %d",i,*p); c = (int*) calloc(2); printf(" %d ",*c); }
define string ?