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

Answer Posted / ramesh mca gprec knl

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("Enter two no");
scanf("%d%d",&a,&b);
c=a*b;
b=a/b;
a=b/a;
printf("After chanching no is =\n");
printf("a=%d b=%d",a,b);
getch();
}

Is This Answer Correct ?    1 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is methods in c?

631


a direct address that identifies a location by means of its displacement from a base address or segment a) absolute address b) relative address c) relative mode d) absolute mode

640


Explain the advantages and disadvantages of macros.

612


Can you write the algorithm for Queue?

1537


What is formal argument?

633






What is hashing in c?

628


What is clrscr ()?

626


Explain c preprocessor?

671


write a C program:There is a mobile keypad with numbers 0-9 and alphabets on it. Take input 0f 7 keys and then form a word from the alphabets present on the keys.

14934


Tell me is null always defined as 0(zero)?

660


Can we declare function inside main?

553


Create a structure to specify data on students as given below: Roll number, Name, Department, Course, and Year of joining. Assume that there are not more than 450 students in the collage. (a) Write a function to print the names of all students who joined in the last 3 years. (b) Write a function to print the data of a student whose roll numbers are divisible by 4.

588


where are auto variables stored? What are the characteristics of an auto variable?

574


What is stack in c?

597


What are reserved words with a programming language?

587