How many ways are there to swap two numbers without using
temporary variable? Give the each logic.
Answer Posted / gana samantula
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf(" Enter the first No.:");
scanf("%d",&a);
printf(" Enter the second No.:");
scanf("%d",&b);
b=a+b-(a=b);
printf(" the swap of a and b numbers :%d %d",a,b);
getch();
}
| Is This Answer Correct ? | 14 Yes | 0 No |
Post New Answer View All Answers
What are the types of unary operators?
How can I send mail from within a c program?
How do you define CONSTANT in C?
What are void pointers in c?
What are the 5 types of inheritance in c ++?
What are multibyte characters?
What is the auto keyword good for?
write a c program to print the next of a particular no without using the arithmetic operator or looping statements?
How many identifiers are there in c?
How are 16- and 32-bit numbers stored?
Explain what are reserved words?
What is the use of parallelize in spark?
i want to switch my career from quailty assurance engineering to development kindly guide me from which programming language its better for me to start plz refer some courses or certifications too i have an experience of 1.5 yrs in QA field.Kindly guide me
What are the disadvantages of c language?
main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }