How can u swap 2 variables in C without using 3rd variable?

Answers were Sorted based on User's Feedback



How can u swap 2 variables in C without using 3rd variable?..

Answer / sj

main()
{
int a=20,b=30;
clrscr();
a=a+b;
b=a-b;
a=a-b;
printf("%d%d",a,b);
getch();
}

Is This Answer Correct ?    38 Yes 4 No

How can u swap 2 variables in C without using 3rd variable?..

Answer / deepa

main()
{
int a=20,b=30;
clrscr();
b=a+b;
a=b-a;
b=b-a;
printf("%d%d",a,b);
getch();
}

Is This Answer Correct ?    5 Yes 4 No

How can u swap 2 variables in C without using 3rd variable?..

Answer / rahul

#include<stdio.h>
#include<conio.h>
void main()
{
int a=20,b=30,c;
clrscr();
a=a+b;
b=b+a;
c=a+b;
c=b-a;
printf("swapping two variables using 3rd variable");
scanf("%d%d%d,a,b,c);
getch();
}

Is This Answer Correct ?    2 Yes 8 No

Post New Answer

More Manual Testing Interview Questions

what is penetration testing

2 Answers   Citrix,


what is agile testing?

10 Answers   Wipro,


What is the difference between QA and QC in testing activity.

3 Answers  


wht is test scenario?

5 Answers  


Hi everyone.This is one of my interview questions.Could you please send me the answer for this?My ID:spam4rekha@gmail.com Q : what is BVA and ECP ? Thank You rekha

4 Answers  






what type of questions we can ask the interviewer after finishing of the interview?

3 Answers  


what is the difference between system integrated testing and integrated system testing?

1 Answers  


How much the bug is affecting the functionality of the application?

0 Answers  


even though automation tools are fast and reliable why do we go for manual testing..in almost 90% of the companies manual testing is used

5 Answers  


For Editing functionality: If there are 10 fields on survey form.User can edit anything from theese 10 fields. User can edit only first field or he can edit 3 fields at a time or can edit all 10 fields at a time or can edit 1 field of one survey form, 2nd field of 2nd survey form, 3rd field of 3rd survey form etc. upto 10th fields or nothing will edit & close the form . My question is --> I have to write test cases for above all scenarios? Let me know it's urgent.

1 Answers  


If a TESTER finds a defect in a WEB APPLICATION, and then raised a ticket to developer. But a developer was unable to reproduce the same defect, then what a tester must do. And what a tester needs to explain a developer...?

3 Answers   CSC,


What is Smoke testing,in smoke testing time u will prepare the test cases or not?

10 Answers   Sonata,


Categories