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


Please Help Members By Posting Answers For Below Questions

Explain how can you tell whether two strings are the same?

587


Who invented bcpl language?

709


What are predefined functions in c?

572


Explain how can I open a file so that other programs can update it at the same time?

599


#include { printf("Hello"); } how compile time affects when we add additional header file .

1430






How old is c programming language?

588


What is the mean of function?

653


How do you determine a file’s attributes?

608


What is the use of f in c?

563


Is linux written in c?

605


What are the different file extensions involved when programming in C?

768


What does c mean before a date?

596


hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm

1637


#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); }

635


define string ?

673