Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


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

void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }

1 Answers  


Find the largest number in a binary tree

7 Answers   Infosys,


#define a 10 int main() { printf("%d..",a); foo(); printf("%d..",a); return 0; } void foo() { #undef a #define a 50 }

2 Answers  


What are the files which are automatically opened when a C file is executed?

1 Answers  


main() { char *p; p="%d\n"; p++; p++; printf(p-2,300); }

1 Answers  






#include<stdio.h> #include<conio.h> void main() { int a=(1,2,3,(1,2,3,4); switch(a) { printf("ans:"); case 1: printf("1");break; case 2: printf("2");break; case 3: printf("1");break; case 4: printf("4");break; printf("end"); } getch(); }

0 Answers  


void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }

4 Answers  


how can i search an element in an array

2 Answers   CTS, Microsoft, ViPrak,


How do you write a program which produces its own source code as its output?

7 Answers  


C statement to copy a string without using loop and library function..

2 Answers   Persistent, TCS,


#define prod(a,b) a*b main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }

1 Answers  


Extend the sutherland-hodgman clipping algorithm to clip three-dimensional planes against a regular paralleiepiped

1 Answers   IBM,






Categories