write a program to swap two numbers without using temporary
variable?
Answer Posted / guest
[code]
main()
{
int a=10;
int b=20;
printf("a = %d\nb = %d\n",a,b);
a =a+b; b=a-b; a=a-b; // This is first way.
a =a*b; b=a/b; a=a/b;
printf("a = %d\nb = %d\n",a,b);
}
[/code]
[code]
main()
{
int a=10;
int b=20;
printf("a = %d\nb = %d\n",a,b);
a =a*b; b=a/b; a=a/b; //This is second way
printf("a = %d\nb = %d\n",a,b);
}
[/code]
| Is This Answer Correct ? | 19 Yes | 2 No |
Post New Answer View All Answers
What are the types of c language?
What are the features of the c language?
One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
What are the salient features of c languages?
How can you tell whether a program was compiled using c versus c++?
What is this pointer in c plus plus?
Can we assign string to char pointer?
Can you define which header file to include at compile time?
Explain bit masking in c?
Are enumerations really portable?
Why should I use standard library functions instead of writing my own?
a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list
How can you return multiple values from a function?
What is a buffer in c?