Write a program to interchange two variables without using
the third variable?

Answer Posted / neelam

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
clrscr();
printf("Enter two no.s 4 swap");
scanf("%d%d",&a,&b);
a=a+b;;
b=a-b;
a=a-b;
printf("After swapping no.s are =\n");
printf("a=%d b=%d",a,b);
getch();
}

Is This Answer Correct ?    0 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of macro in C language?

642


What is data types?

607


What are the different file extensions involved when programming in C?

725


how to construct a simulator keeping the logical boolean gates in c

1696


a sequence of bytes with one to one corrspondence to those in the external device a) sequential addressing b) address c) byte code d) none

694






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

1530


a value that does not change during program execution a) variabe b) argument c) parameter d) none

669


what are the program that using a two dimensional array that list the odd numbers and even numbers separately in a given 10 inputs values

1229


What is typedf?

641


What is structure padding and packing in c?

587


Differentiate between declaring a variable and defining a variable?

586


What do you mean by dynamic memory allocation in c?

624


What is the sizeof () a pointer?

531


What is indirection in c?

596


Describe how arrays can be passed to a user defined function

754