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

Answer Posted / rani

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf ("enter the values to a & b");
scanf("%d%d",&a,&b);
a=a+b;
b=a-b;
a=a-b;
printf("%d%d",a,b);
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What does *p++ do?

579


What is the difference between a function and a method in c?

556


‘SAVEPOINT’ and ‘ROLLBACK’ is used in oracle database to secure the data comment. Give suitable examples of each with sql command.

1872


stripos — Find position of first occurrence of a case- insensitive string int stripos ( char* haystack, char* needle, int offset ) Returns the numeric position of the first occurrence of needle in the haystack string. Note that the needle may be a string of one or more characters. If needle is not found, stripos() will return -1. The function should not make use of any C library function calls.

1847


Can you please explain the difference between strcpy() and memcpy() function?

594






What is difference between scanf and gets?

606


 write a program that will open the file, count the number of occurences of each word in the the complete works of shakespeare.  You will then tabulate this information in another file.

1722


How can I find the modification date of a file?

698


What is the purpose of realloc()?

663


What do you understand by friend-functions? How are they used?

641


What is a loop?

548


What is a null pointer in c?

589


What is property type c?

599


What is the difference between single charater constant and string constant?

615


What does double pointer mean in c?

573