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 is the difference between exit() and _exit() function?
Why static variable is used in c?
You are to write your own versions of strcpy() and strlen (). Call them mystrcpy() and mystrlen(). Write them first as code within main(), not as functions, then, convert them to functions. You will pass two arrays to the function in the case of mystrcpy(), the source and target array.
Where define directive used?
What is array of pointers to string?
main() { printf("hello"); fork(); }
What is methods in c?
WHICH TYPE OF JOBS WE GET BY WRITING GROUPS .WHEN THE EXAMS CONDUCTED IS THIS EXAMS ARE CONDUCTED EVERY YEAR OR NOT.PLS TELL ME THE ANSWER
Explain why c is faster than c++?
Explain what math functions are available for integers? For floating point?
Hai sir, I had planned to write the NIC scientific engineer exam , plz post the sample question......
Are there constructors in c?
write a program fibonacci series and palindrome program in c
What are the types of data files?
How can I change the size of the dynamically allocated array?