write a program to swap Two numbers without using temp variable.
Answer Posted / diponkor roy
#include<iostream>
using namespace std;
int main()
{
int x,y;
cin>>x;
cin>>y;
cout<<"You enter"<<x <<" and"<<y<<endl;
x=x*y;
y=x/y;
x=x/y;
cout<<"After swap your number "<<x <<" and"<<y<<endl;
return 0;
}
| Is This Answer Correct ? | 2 Yes | 3 No |
Post New Answer View All Answers
How can you avoid including a header more than once?
Why shouldn’t I start variable names with underscores?
how can I convert a string to a number?
What is difference between union and structure in c?
FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.
What are pointers? What are stacks and queues?
What is the newline escape sequence?
What is cohesion and coupling in c?
Between macros and functions,which is better to use and why?
What does malloc () calloc () realloc () free () do?
What is the mean of function?
Difference between malloc() and calloc() function?
code for replace tabs with equivalent number of blanks
Subtract Two Number Without Using Subtraction Operator
What is break in c?