How many ways are there to swap two numbers without using
temporary variable? Give the each logic.
Answer Posted / vignesh1988i
as for i know their are two different logics for the
swapping techinque.... swapping is a type of techinque used
for interchanging the two varibles in the operating
memory....
1) using only variables
2) using EX-OR operator '^'
first logic only know.
void main()
{
int a,b;
printf("enter the a&b");
scanf("%d%d",&a,&b);
a+=b;
b=a-b;
a-=b;
printf("a=%d\nb=%d",a,b);
getch();
}
| Is This Answer Correct ? | 48 Yes | 4 No |
Post New Answer View All Answers
What does emoji p mean?
How are portions of a program disabled in demo versions?
Is null valid for pointers to functions?
List some applications of c programming language?
What is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?
What is meant by recursion?
What are the ways to a null pointer can use in c programming language?
Explain what are the different data types in c?
Why do we need a structure?
What is the use of c language in real life?
Explain what will the preprocessor do for a program?
Explain the array representation of a binary tree in C.
The program will first compute the tax you owe based on your income. User is prompted to enter income. Program will compute the total amount of tax owed based on the following: Income Tax 0 - $45,000 = 0.15 x income $45,001 - $90,000 = 6750 + 0.20 x (income – 45000) $90,001 - $140,000 = 15750 + 0.26 x (income – 90000) $140,001 - $200,000 = 28750 + 0.29 x (income – 140000) Greater than $200,000 = 46150 + 0.33 x (income – 200000) Dollar amounts should be in dollars and cents (float point numbers with two decimals shown). Tax is displayed on the screen.
Where are the auto variables stored?
What is meant by initialization and how we initialize a variable?