How to write the code of the program to swap two numbers
with in one statement?

Answers were Sorted based on User's Feedback



How to write the code of the program to swap two numbers with in one statement?..

Answer / rajitha

#include<stdio.h>
main()
{
int a=3,b=4;
b=a+b-(a=b);
printf("%d",a);
printf("%d",b);
}

Is This Answer Correct ?    19 Yes 4 No

How to write the code of the program to swap two numbers with in one statement?..

Answer / manoj kumar shukla

main()
{
int a=4,b=3;
a=a+b-(b=a);
printf("%d",a);
printf("%d",b);
}

Is This Answer Correct ?    6 Yes 2 No

Post New Answer

More C Interview Questions

How will you allocate memory to double a pointer?

1 Answers  


What is signed and unsigned?

0 Answers  


find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }

0 Answers   Microsoft,


print out of string in this format; 1. "rajesh" 2. \n 3. %d

5 Answers   mpower,


What is the difference between GETS();AND SCANF();

4 Answers   TCS,






Describe dynamic data structure in c programming language?

0 Answers  


Explain output of printf("Hello World"-'A'+'B'); ?

0 Answers  


what is event driven software and what is procedural driven software?

0 Answers  


What is table lookup in c?

0 Answers  


1. Write a c pgm to print 1 to 100 without using loops. 2. Write a c pgm for leap year 3. Write a c pgm fibbonacci series,factorial 4. Write a c pgm count no of lines , blanks, tabs in a para(File concept) 5. Write a c pgm to print the letter as per given condition i.e.. if u give 4 out put should b 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 6.how do get the o/p in number from 1 to 100 in the screen without using control statement? 7. who do u print the word "hello world" without using "printf" statement? 8. write sql program to get the detail of student in a class? Definitions: structure union arrays linkedlist macros directives difference b/w pre processorsDiffrence: 1.Constructors and destructors 2.Structure and Union 3.Array and Lists 4.pre processor... 5. Privillages in C++ 6.structure and union 7.break and continue 8.while and dowhile Pgm..

3 Answers  


What does 3 periods mean in texting?

0 Answers  


two progs are given. one starts counting frm 0 to MAX and the other stars frm MAX to 0. which one executes fast.

5 Answers   Verifone,


Categories