write a origram swaoing valu without 3rd variable

Answers were Sorted based on User's Feedback



write a origram swaoing valu without 3rd variable..

Answer / jeevanvns

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

Is This Answer Correct ?    8 Yes 0 No

write a origram swaoing valu without 3rd variable..

Answer / tejesh

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("enter the value");
scanf("%d%d",&a,&b);
a=a^b; //xor operator -- ^
b=a^b;
a=a^b;
printf("%d\t %d\t",a,b);
getch();
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Code Interview Questions

How to access command-line arguments?

4 Answers  


find A^B using Recursive function

2 Answers  


Design an implement of the inputs functions for event mode

0 Answers   Wipro,


What is "far" and "near" pointers in "c"...?

3 Answers  


Find your day from your DOB?

15 Answers   Accenture, Microsoft,






find simple interest & compund interest

2 Answers  


what will be the output of this program? void main() { int a[]={5,10,15}; int i=0,num; num=a[++i] + ++i +(++i); printf("%d",num); }

3 Answers   Wipro,


main() { int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("\n %d", i); } a. Runtime error. b. 100 c. Some Integer not 100 d. None of the above

2 Answers   HCL, LG,


how to return a multiple value from a function?

5 Answers   Wipro,


write a simple calculator c program to perform addition, subtraction, mul and div.

0 Answers   United Healthcare, Virtusa,


what is oop?

3 Answers  


prog. to produce 1 2 3 4 5 6 7 8 9 10

4 Answers   TCS,


Categories