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

Answer Posted / samruthi

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

printf("\n The value of A is:%d",a);
printf("\n The value of B is:%d",b);
getch();
}

Is This Answer Correct ?    10 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Does sprintf put null character?

607


Write a program to swap two numbers without using the third variable?

602


hi, which software companys will take,if d candidate's % is jst 55%?

1669


What are keywords in c with examples?

609


Where is c used?

656






write a program to print data of 5 five students with structures?

1612


Explain what is wrong with this statement? Myname = ?robin?;

1043


What are the rules for identifiers in c?

592


write a program to concatenation the string using switch case?

1564


The % symbol has a special use in a printf statement. How would you place this character as part of the output on the screen?

773


Explain the meaning of keyword 'extern' in a function declaration.

729


Explain what is the purpose of "extern" keyword in a function declaration?

625


What does struct node * mean?

605


How can you be sure that a program follows the ANSI C standard?

1134


What is memory leak in c?

639