write a program to swap Two numbers without using temp variable.

Answer Posted / sree

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("Enter two numbers");
scanf("%d %d",&a &b);
a=a+b;
b=a-b;
a=a-b;
printf("The swapped values are:");
printf("a:%d",a);
printf("b:%d",b);
getch();
}

Is This Answer Correct ?    73 Yes 24 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does return 1 means in c?

558


What is %s and %d in c?

565


Differentiate between null and void pointers.

610


Difference between strcpy() and memcpy() function?

656


What the advantages of using Unions?

652






What are the ways to a null pointer can use in c programming language?

563


Why dont c comments nest?

596


write a program which the o/p should b in such a way that s triangle if I/p is 3,a Square/rectangle if I/P=4,a pentagon if I/P=5 and so on...forget about the I/P which is less than 3

1624


Can the size of an array be declared at runtime?

581


Define Spanning-Tree Protocol (STP)

617


What is context in c?

515


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

639


Describe static function with its usage?

583


What is the difference between printf and scanf )?

565


What is pointer in c?

707