write a program in C to swap two variables

Answer Posted / r.aruna

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

Is This Answer Correct ?    11 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are multibyte characters?

622


Write a C program that will accept a hexadecimal number as input and then display a menu that will permit any of the following operations to be carried out: Display the hexadecimal equivalent of the one's complement. (b) Carry out a masking operation and then display the hexadecimal equivalent of the result. (c) Carry out a bit shifting operation and then display the hexadecimal equivalent of the result. (d) Exit. If the masking operation is selected, prompt the user lor the type of operation (bitwise and, bitwise exclusive or, or bitwise or) and then a (hexadecimal) value for the mask. If the bit shifting operation is selected. prompt the user for the type of shift (left or right), and then the number of bits. Test the program with several different (hexadecimal) input values of your own choice.

4835


What is character set?

681


Explain is it better to use a pointer to navigate an array of values, or is it better to use a subscripted array name?

669


What is main () in c?

584






What does a pointer variable always consist of?

659


How many types of sorting are there in c?

604


Why can arithmetic operations not be performed on void pointers?

583


What is anagram in c?

511


how can i write a program that prints out a box such that whenever i press any key8(coordinate number) on the keyboard, the box moves.

1209


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

1550


int far *near * p; means

3115


What does do in c?

604


What is ponter?

768


What are the features of the c language?

640