write a program to swap two variables a=5 , b= 10 without
using third variable

Answer Posted / dhanalakshmi

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
printf("enter the a value"));
scanf("%d",&a);//a=10
printf("enter the b value");
scanf("%d",&b);//b=5
b=b+a;
a=b-a;
b=b-a;
printf("\n The value of A is:%d",a);
printf("\n The value of B is:%d",b);
}

Is This Answer Correct ?    6 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a program to check prime number in c programming?

604


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

1675


What is keyword in c?

606


How can I run c program?

692


Give differences between - new and malloc() , delete and free() ?

614






Is multithreading possible in c?

572


Why c language?

652


What is calloc() function?

627


Explain about block scope in c?

663


What is difference between array and structure in c?

583


Why void main is used in c?

564


What is null in c?

602


How to declare pointer variables?

688


Explain what are multidimensional arrays?

607


What is the -> in c?

589