Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


HOW TO SWAP TWO NOS IN ONE STEP?

Answers were Sorted based on User's Feedback



HOW TO SWAP TWO NOS IN ONE STEP?..

Answer / shiva kumar

void main()
{
int a,b;
printf("Enter two numbers\n");
scanf("%d%d",&a,&b);
b=a+b-(a=b);
printf("%d %d ",a,b);
}

Is This Answer Correct ?    28 Yes 7 No

HOW TO SWAP TWO NOS IN ONE STEP?..

Answer / rajkumar

(a=a-(b=(a=a+b)-b));

Is This Answer Correct ?    9 Yes 3 No

HOW TO SWAP TWO NOS IN ONE STEP?..

Answer / ashik

#define swap(a,b) a^=b^=a^=b;

Is This Answer Correct ?    6 Yes 4 No

HOW TO SWAP TWO NOS IN ONE STEP?..

Answer / sasikumar

main()
{
int a,b,c;
printf("enter two no's :");
scanf("%d%d",&a,&b);
c=a^=b^=a^=b;
printf("%d",c);
}

Is This Answer Correct ?    6 Yes 6 No

HOW TO SWAP TWO NOS IN ONE STEP?..

Answer / vijay

#include<stdio.h>
main()
{
int a=5,b=9;
printf("%d %d \n",a,b);
a^=b^=a^=b;
printf("%d %d \n",a,b);
}

Is This Answer Correct ?    4 Yes 4 No

HOW TO SWAP TWO NOS IN ONE STEP?..

Answer / sumit

b=abs((a=b)-(a+b));

Is This Answer Correct ?    1 Yes 1 No

HOW TO SWAP TWO NOS IN ONE STEP?..

Answer / eswaran

Sasi kumar answer is very wrong answer .....

Is This Answer Correct ?    0 Yes 0 No

HOW TO SWAP TWO NOS IN ONE STEP?..

Answer / venkatesh sabinkar

#include<stdio.h>
#include<conio.h>
void main()
{
int a=5,b=2,t;
clrscr();
printf("a=%d,b=%d",a,b,b=t,a=b,t=a);
getch();
}

Is This Answer Correct ?    3 Yes 4 No

HOW TO SWAP TWO NOS IN ONE STEP?..

Answer / z

Trick question: the phrase "one step" is undefined.
Example: how many steps are there in the following statement?
a = ++b;

Is This Answer Correct ?    0 Yes 1 No

HOW TO SWAP TWO NOS IN ONE STEP?..

Answer / amaresh chandra das

amaresh@Hare-Krishna:~$ cat swp.c
#include<stdio.h>
int
main(){
int a=5,b=6; // Compile using gcc -Wall
#ifdef DEBUG // to avoid compiler warnings
a ^=b^=a^=b;
#endif
printf("value of a is %d and b is %d\n",a,b);
return 0;
}

Is This Answer Correct ?    2 Yes 4 No

Post New Answer

More C Interview Questions

what is computer engg

1 Answers  


What is an endless loop?

0 Answers  


What is the main differences between C and Embedded C?

9 Answers  


what is different between auto and local static? why should we use local static?

0 Answers  


What is a const pointer in c?

0 Answers  


Sir,please help me out with the code of this question. Write an interactive C program that will encode or decode multiple lines of text. Store the encoded text within a data file, so that it can be retrieved and decoded at any time. The program should include the following features: (a) Enter text from the keyboard, encode the text and store the encoded text in a data file. (b) Retrieve the encoded text and display it in its encoded form. (c) Retrieve the encoded text, decode it and then display the decoded text. (d) End the computation. Test the program using several lines of text of your choice.

0 Answers  


What is far pointer in c?

0 Answers  


get any number as input except 1 and the output will be 1.without using operators,expressions,array,structure.don't print 1 in printf statement

3 Answers  


Once I have used freopen, how can I get the original stdout (or stdin) back?

0 Answers  


What are the general description for loop statement and available loop types in c?

0 Answers  


What is typedef struct in c?

0 Answers  


how to print a statement in c without use of console statement ,with the help of if statement it should print

2 Answers   Satyam,


Categories