write a program to swap Two numbers without using temp variable.

Answer Posted / prudhvi

int a, b, c;
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
c = b;
b = a;
a = c;
Console.WriteLine("a={0},b={1}",a,b);
Console.ReadLine();




}

Is This Answer Correct ?    0 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is build process in c?

635


What is a program flowchart and how does it help in writing a program?

652


What does 2n 4c mean?

701


What are pointers?

622


Why functions are used in c?

578






What are the modifiers available in c programming language?

726


write a c program to find the sum of five entered numbers using an array named number

1615


What is the use of function overloading in C?

668


Why is it important to memset a variable, immediately after allocating memory to it ?

1546


Why do we need a structure?

580


Why is c faster?

585


What does *p++ do? What does it point to?

608


Find duplicates in a file containing 6 digit number (like uid) in O (n) time.

2586


What is the meaning of 2d in c?

601


In this assignment you are asked to write a multithreaded program to find the duplicates in an array of 10 million integers. The integers are between -5000,000 to 5000,000 and are generated randomly. Use 10 threads, each thread works on 1000,000 integers. Compare the time needed to accomplish the task with single thread of execution program. Do not include the time to fill the array with integers in the execution time.

2672