write a program to swap Two numbers without using temp variable.
Answer Posted / amit chauhan
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("\n Enter the 2 numbers");
scanf("%d%d",&a,&b);
//swaping of 2 numbers without using temp variable
a=a+b;
b=a-b;
a=a-b;
/* or
a=a*b;
b=a/b;
a=a/b;
*/
printf("\n A = %d \n B = %d\n");
getch();
}
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
What is the Purpose of 'extern' keyword in a function declaration?
What is wrong with this declaration?
What are the different types of C instructions?
What are the functions to open and close file in c language?
What is the meaning of ?
What do you mean by dynamic memory allocation in c?
How do you determine the length of a string value that was stored in a variable?
Is main a keyword in c?
about c language
What are lookup tables in c?
Does c have class?
Describe explain how arrays can be passed to a user defined function
What is the difference between NULL and NUL?
What are the types of unary operators?
Create a registration form application by taking the details like username, address, phone number, email with password and confirm password (should be same as password).Ensure that the password is of 8 characters with only numbers and alphabets. Take such details for 3 users and display the details. While taking input password must appear as “****”.