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

Answer Posted / nagendra kumar

#include<stdio.h>
main(){
int a,b;

printf("Enter A value: ");
scanf("%d",&a);

printf("\nEnter B value: ");
scanf("%d",&b);


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

a=a+b;
b=a-b;
a=a-b;

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

Is This Answer Correct ?    19 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define circular linked list.

574


How can you check to see whether a symbol is defined?

596


What is the use of #include in c?

585


How do we declare variables in c?

578


Write the control statements in C language

656






Is c language still used?

540


What is the difference between printf and scanf in c?

757


In the DOS enveronment, normal RAM that resides beyond the 1mb mark. a) expanded memory b) swapped memory c) Extended memory d) none

728


What is 1f in c?

1844


What is structure padding in c?

632


What is the use of header files?

610


What is the right way to use errno?

625


Who is the founder of c language?

688


praagnovation

1781


What are the advantages and disadvantages of c language?

568