write a program in C to swap two variables

Answer Posted / senthil mca sns

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter the a value:");
scanf("%d",&a);
printf("Enter the b value:");
scanf("%d",&b);
b=a+b-(a=b);
printf("After Swapping a=%d,b=%d",a,b);
getch();
}

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is call by reference in functions?

880


What are header files and explain what are its uses in c programming?

844


PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM

1951


what are the 10 different models of writing an addition program in C language?

1659


What does main () mean in c?

860


Why pointers are used?

830


how to execute a program using if else condition and the output should enter number and the number is odd only...

1931


Where are the auto variables stored?

851


What is use of #include in c?

823


int far *near * p; means

3306


What is dynamic memory allocation?

1048


Why c language is called c?

744


How pointers are declared?

727


How would you obtain the current time and difference between two times?

982


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.

2885