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

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what is the advantage of a random access file?

650


What are the types of i/o functions?

673


Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

2976


can anyone suggest some site name..where i can get some good data structure puzzles???

1639


Are there constructors in c?

588






Explain what are the __date__ and __time__ preprocessor commands?

584


Write the syntax and purpose of a switch statement in C.

614


How can my program discover the complete pathname to the executable from which it was invoked?

657


4-Take two sets of 5 numbers from user in two arrays. Sort array 1 in ascending and array 2 in descending order. Perform sorting by passing array to a function mySort(array, sortingOrder). Then multiply both the arrays returned from function, using metric multiplication technique in main. Print result in metric format.

1721


What does sizeof return c?

596


What 'lex' does?

710


Write a c program to build a heap method using Pointer to function and pointer to structure ?

4169


Why structure is used in c?

578


What is a file descriptor in c?

555


What are derived data types in c?

603