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
An arrangement of information in memory in such a way that it can be easily accessed and processed by a programming language a) string b) data structure c) pointers d) array
What is the best way of making my program efficient?
What is the use of in c?
How are variables declared in c?
How is a macro different from a function?
What is quick sort in c?
What is the difference between the = symbol and == symbol?
Difference between Function to pointer and pointer to function
main() { printf("hello"); fork(); }
Tell me when would you use a pointer to a function?
how to execute a program using if else condition and the output should enter number and the number is odd only...
What is the time and space complexities of merge sort and when is it preferred over quick sort?
Explain what is meant by high-order and low-order bytes?
Write a c program to demonstrate character and string constants?
Is c is a procedural language?