How many ways are there to swap two numbers without using
temporary variable? Give the each logic.
Answer Posted / gana samantula
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf(" Enter the first No.:");
scanf("%d",&a);
printf(" Enter the second No.:");
scanf("%d",&b);
b=a+b-(a=b);
printf(" the swap of a and b numbers :%d %d",a,b);
getch();
}
| Is This Answer Correct ? | 14 Yes | 0 No |
Post New Answer View All Answers
i have a written test for microland please give me test pattern
How can I delete a file?
Is it possible to use curly brackets ({}) to enclose single line code in c program?
What are the functions to open and close file in c language?
What are qualifiers?
What are the __date__ and __time__ preprocessor commands?
What is a stream?
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
When is a “switch” statement preferable over an “if” statement?
Explain with the aid of an example why arrays of structures don’t provide an efficient representation when it comes to adding and deleting records internal to the array.
given post order,in order construct the corresponding binary tree
What is operator precedence?
If null and 0 are equivalent as null pointer constants, which should I use?
What is wrong in this statement? scanf(“%d”,whatnumber);
What are the storage classes in C?