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

What are the uses of pre-processor directives?

2 Answers  


What is meant by recursion?

0 Answers   ADP,


What is the best way to comment out a section of code that contains comments?

0 Answers  


c program to arrange digits in a no in ascending and descending order

1 Answers  


What are different types of pointers?

0 Answers  






what is the use of ‘auto’ keyword?

1 Answers  


If you know then define #pragma?

0 Answers  


How can a program be made to print the line number where an error occurs?

0 Answers  


Where does the name "C" come from, anyway?

0 Answers   Celstream,


please give me a VIRTUSA sample palcement papers.... you will only send TECHNICAL SECTION..... that is help for me Advance Thanks........................

0 Answers  


Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record

0 Answers   Wipro,


pgm in c to reverse string by word using array(god is love becomes love is god) (no additional array can used,space is only delimiter between words )

2 Answers   Persistent,


Categories