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


Please Help Members By Posting Answers For Below Questions

What are operators in c?

586


What is realloc in c?

581


#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); }

721


How do I use strcmp?

645


How can type-insensitive macros be created?

705






Which is the best website to learn c programming?

585


In C programming, how do you insert quote characters (‘ and “) into the output screen?

898


In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping

983


What is clrscr ()?

641


What is string length in c?

618


What is the meaning of 2d in c?

617


What is C language ?

1533


Explain how do you declare an array that will hold more than 64kb of data?

906


What language is c written?

580


How can I read/write structures from/to data files?

554