How do we swap or interchange any 2 numbers without using
Temporary variable...Anybody can pls answer it.. Thanks in
Advance
Answer Posted / divya
#include<stdio.h>
main()
(
clrscr();
int a,b;
printf("enter a and b values");
scanf("%d \n %d",&a,&b);
printf("before swaping a value is:%d",a);
printf("before swaping b value is:%d",b);
a=a+b;
b=a-b;
a=a-b;
printf("after swaping a value is:%d",a);
printf("after swaping b value is:%d",b);
getch();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
Is swift based on c?
Explain what is wrong with this program statement?
How does selection sort work in c?
Define VARIABLE?
What is the purpose of void in c?
write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.
Explain how do you search data in a data file using random access method?
Explain how can I right-justify a string?
2) Write a program that will help Air Traffic Control for an airport to view the sequence of flights ready for take-off. The airport can accommodate 10 flights waiting for take-off at any point in time. Each flight has a unique 3 digit numeric identifier. Each time a flight takes-off, Air Traffic Control adds a flight to the waitlist. Each time a flight is added to the waitlist, the list of flights waiting to take-off must be displayed. When a flight is cleared for take-off, Air Traffic Control removes the flight from the waitlist. Each time a flight takes-off, the list of flights waiting to take-off must be displayed. Sequence of take-off is the sequence of addition to the waitlist
What is include directive in c?
What does the characters “r” and “w” mean when writing programs that will make use of files?
what value is returned to operating system after program execution?
For what purpose null pointer used?
What does void main () mean?