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...


write a prgram of swapping with 2 valiables

Answers were Sorted based on User's Feedback



write a prgram of swapping with 2 valiables..

Answer / eranna kybarshi

#include<stdio.h>
#include<conio.h>
void main()
{
int x,y;
clrscr();

printf("Enter 'x' value :");
scanf("%d",&x);

printf("\nEnter 'y' value :");
scanf("%d",&y);

x=x+y;
y=x-y;
x=x-y;
printf("\nAfter swaping x= %d,y= %d ",x,y);

getch();
}

Is This Answer Correct ?    20 Yes 0 No

write a prgram of swapping with 2 valiables..

Answer / vijay r15

#include<stdio.h>
Void main()
{
int a=10,b=20;
a=a+b-(a=b);
// or use temp var
//or use a^=b^=a
//or use a=a+b;b=a-b;a=a-b;
printf("%d%d",a,b);
}

Any dbt mail to raj.vijay55@gmail.com

Is This Answer Correct ?    3 Yes 1 No

write a prgram of swapping with 2 valiables..

Answer / kumar

#include<stdio.h>
#include<conio.h>
void main()
{
int x,y ;
int z = 0;
clrscr();

printf("Enter 'x' value :");
scanf("%d",&x);

printf("\nEnter 'y' value :");
scanf("%d",&y);

z=x;
x=y;
y=z;
printf("\nAfter swaping x= %d,y= %d ",x,y);

getch();
}

Is This Answer Correct ?    4 Yes 2 No

write a prgram of swapping with 2 valiables..

Answer / aruna.r

#include<stdio.h>
#include<conio.h>
void main()
{
int a=6;
int b=5;
int temp;
temp=a;
a=b;
b=temp;
printf("a & b value %d,%d",a,b);
getch();
}

Is This Answer Correct ?    3 Yes 2 No

write a prgram of swapping with 2 valiables..

Answer / suresh

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
d=0;
printf("enter a");
scanf("%d",&a);
printf("enter b");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf("a & b value are%d%d",a,b);
getch();
}

Is This Answer Correct ?    0 Yes 0 No

write a prgram of swapping with 2 valiables..

Answer / devi

i can swap da 2 variables in singe instr
main()
{
int a,b;
a=(a=(a+b),b=(a-b),a-b);
-------
-------
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

int i; i=2; i++; if(i=4) { printf(i=4); } else { printf(i=3); } output of the program ?

15 Answers   Mascot,


Rapunzel walks into the forest of forgetfullness. She meets a Lion who lies on Monday Tuesdays and Wednesdays and meets a rabbit who lies on Thurs fridays and saturdays . On that day both say that "I lied yesterday". What day is it .

3 Answers   TCS,


10. Study the code: void show() main() { show(); } void show (char *s) { printf("%sn",s); } What will happen if it is compiled & run on an ANSI C Compiler? A)It will compile & nothing will be printed when it is executed B)it will compile but not link C)the compiler will generate an error D)the compiler will generate a warning

5 Answers   Accenture,


Is the below things valid & where it will be stored in memory layout ? static const volatile int i; register struct { } ; static register;

2 Answers   Lucent,


User define function contain thier own address or not.

2 Answers  


What is difference between Structure and Unions?

0 Answers   TISL,


What are c identifiers?

0 Answers  


atoi, which takes a string and converts it to an integer. write a program that reads lines(using getline), converts each line to an integer using atoi and computes the average of all the numbers read. also compute the standard deviation

0 Answers  


The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?

0 Answers  


How can you find the day of the week given the date?

0 Answers  


What is the difference between void main() and int main()?

1 Answers  


What does stand for?

0 Answers  


Categories