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

main() { int i; for(i=0;i<5;i++) printf("%d",1l<<i); } why doesn't 'l' affect the code??????

1 Answers  


Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?

0 Answers   Infosys,


What is the explanation for the dangling pointer in c?

0 Answers  


What are the main characteristics of c language describe the structure of ac program?

0 Answers  


What is the use of a static variable in c?

0 Answers  






what is the advantage of using SEMAPHORES to ORDINARY VARIABLES???

2 Answers   NSN,


Write a code to determine the total number of stops an elevator would take to serve N number of people.

0 Answers   Expedia,


Explain the concept and use of type void.

0 Answers  


design and implement a data structure and performs the following operation with the help of file (included 1000 student marks in 5 sub. and %also) 1.how many students are fail in all 5 subjects (if >35) 2. delete all student data those are fail in all 5 subjects. 3. update the grace marks (5 no. if exam paper is 100 marks) 4. arrange the student data in ascending order basis of marks. 5.insert double of deleted students with marks in the list.

0 Answers   TCS,


What is the benefit of using #define to declare a constant?

0 Answers  


Is that possible to store 32768 in an int data type variable?

0 Answers  


What is the c value paradox and how is it explained?

0 Answers  


Categories