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
general for is %wd,f-d; in this system "w" means a) 'w' represent total width of digits b) 'w' represent width which includes the digits before,after decimal place and the decimal point c) 'w' represent width which includes the digits before only d) 'w' represent width after decimal place only
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
Explain what are preprocessor directives?
Are c and c++ the same?
What is difference between array and structure in c?
What type of function is main ()?
How can you draw circles in C?
define string ?
How do you declare a variable that will hold string values?
Where define directive used?
Explain what are reserved words?
Write a program to check palindrome number in c programming?
What is the use of a ‘ ’ character?
Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record
What is sorting in c plus plus?