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

Answer Posted / ashish kumar sharma

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter the Value of a:\n");
scanf("%d",&a);
printf("enter the Value of b:\n");
scanf("%d",&b);
a=a+b;
b=a-b;
a=a-b;
printf("Display The Swapping:\n");
printf("a=%d And b=%d",a,b);
getch();
}

Is This Answer Correct ?    1 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the use of sizeof?

550


Can you return null in c?

591


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

653


What is the use of a semicolon (;) at the end of every program statement?

764


Should a function contain a return statement if it does not return a value?

592






How can I convert a number to a string?

604


What are different types of variables in c?

566


What are global variables?

640


write a program fibonacci series and palindrome program in c

630


a c code by using memory allocation for add ,multiply of sprase matrixes

2296


what is a constant pointer in C

674


What are the 5 data types?

596


Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.

4835


Is c still used?

598


Under what circumstances does a name clash occur?

686