swap two integer variables without using a third temporary
variable?
Answer Posted / sidhartha
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("\n ENTER 2 VALUES : ");
scanf("%d%d",&a,&b);
printf("\n THE VALUES BEFORE SORTING : %d,%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("\n THE VALUES AFTER SORTING : %d,%d",a,b);
getch();
}
Is This Answer Correct ? | 40 Yes | 1 No |
Post New Answer View All Answers
Why dont c comments nest?
Write a simple code fragment that will check if a number is positive or negative.
How can variables be characterized?
What is meant by initialization and how we initialize a variable?
a value that does not change during program execution a) variabe b) argument c) parameter d) none
What is the general form of a C program?
why to assign a pointer to null sometimes??how can a pointer we declare get assigned with a garbage value by default???
Does sprintf put null character?
What is the difference between printf and scanf in c?
What is structure padding and packing in c?
Do you know what are the properties of union in c?
What is const keyword in c?
The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?
Explain what is the benefit of using const for declaring constants?
What is scanf () in c?