write a program to swap Two numbers without using temp variable.
Answer Posted / sams
Two numbers are input through the keyboard into two
locations C and D. Write a program to interchange the
contents of C and D.
#include<stdio.h>
#include<conio.h>
void main( )
{
int a,b,c;
clrscr( );
printf("Enter A: ");
scanf("%d",&a);
printf("Enter B: ");
scanf("%d",&b);
c=a;
a=b;
b=c;
printf("\n The New Value Of A is : %d",a);
printf("\n The New Value Of B is : %d",b);
getch();
}
Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
What is the scope of global variable in c?
Tell me what is null pointer in c?
How do you redirect a standard stream?
What is break statement?
a value that does not change during program execution a) variabe b) argument c) parameter d) none
Can we initialize extern variable in c?
Explain how can type-insensitive macros be created?
What are the types of variables in c?
What is nested structure with example?
When should structures be passed by values or by references?
What is the use of define in c?
Can we use any name in place of argv and argc as command line arguments?
What is a structure in c language. how to initialise a structure in c?
What is difference between union and structure 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?