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
What are derived data types in c?
Explain what is operator promotion?
Want to know how to write a C program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the total number of disk writes by MySQL.
In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping
What is nested structure with example?
What are the types of bitwise operator?
What are the application of void data type in c?
What is c++ used for today?
Can we change the value of constant variable in c?
List at least 10 sorting methods indicating their average case complexity, worst case complexity and best case complexity.
What are the data types present in c?
What is static function in c?
What are global variables and how do you declare them?
how to write a c program to print list of fruits in alpabetical order?
What does return 1 means in c?