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

diff b/w waterfall model & spiral model?

14 Answers   APIIT, BBD, QQ, Rift Valley Institute of Science and Technology RVIST, Wipro,


Explain the difference between alpha testing and beta testing.

0 Answers  


what does a test plan contains and is a tester allowed to see the entire test plan or only the scheduling part of the test plan

1 Answers  


What are techniques for Integration Testing.

3 Answers  


In the place of button developer use image, during the tab movements image(button) is not highlighted is it bug or not?

6 Answers  






Difference between regression testing and re-testing

5 Answers   Value Labs,


Give an example of test policy?

2 Answers  


Among 5000 test cases, how to pick test cases for regression testing

4 Answers  


Why Should we prepare traceability matrix?

10 Answers   MBT,


I need a Test case templetes for Yahoo Mail ID

1 Answers  


What is the difference between Functional requirement and business requirements?

2 Answers   Covansys,


What is the difference between Monkey testing an Ad-hoc testing (If ur answer is same, then why we need two names)

6 Answers   CFC, CTS, PRO, Protech,


Categories