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 operators in c?
What is realloc in c?
#include main() { enum _tag{ left=10, right, front=100, back}; printf("left is %d, right is %d, front is %d, back is %d",left,right,front,back); }
How do I use strcmp?
How can type-insensitive macros be created?
Which is the best website to learn c programming?
In C programming, how do you insert quote characters (‘ and “) into the output screen?
In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping
What is clrscr ()?
What is string length in c?
What is the meaning of 2d in c?
What is C language ?
Explain how do you declare an array that will hold more than 64kb of data?
What language is c written?
How can I read/write structures from/to data files?