write a program to swap Two numbers without using temp variable.
Answer Posted / insane programmer
#include<stdio.h>
#include<conio.h>
void main()
{
int a=100, b=30;
clrscr();
a = a+b;
b = a-b;
a = a-b;
printf("Swapping without using third variable (using + and -).\n\n");
printf("Value of a=%d and b=%d.", a,b);
getch();
}
you can get more example here http://rajkishor09.hubpages.com/_eknow/hub/How-to-swap-two-numbers-without-using-third-temp-variable
Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is union and structure?
What do you mean by scope of a variable in c?
Differentiate between calloc and malloc.
What does *p++ do? What does it point to?
What is the difference between single charater constant and string constant?
What should malloc() do? Return a null pointer or a pointer to 0 bytes?
What is static and auto variables in c?
What is a list in c?
What is the right type to use for boolean values in c? Is there a standard type? Should I use #defines or enums for the true and false values?
How can a process change an environment variable in its caller?
What is the usage of the pointer in c?
how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.
Write a program to produce the following output: 1 2 3 4 5 6 7 8 9 10
What is structure data type in c?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above