How do we swap or interchange any 2 numbers without using
Temporary variable...Anybody can pls answer it.. Thanks in
Advance
Answer Posted / divya
#include<stdio.h>
main()
(
clrscr();
int a,b;
printf("enter a and b values");
scanf("%d \n %d",&a,&b);
printf("before swaping a value is:%d",a);
printf("before swaping b value is:%d",b);
a=a+b;
b=a-b;
a=a-b;
printf("after swaping a value is:%d",a);
printf("after swaping b value is:%d",b);
getch();
}
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What is scope and lifetime of a variable in c?
What is header file definition?
What is void pointers in c?
What are the restrictions of a modulus operator?
Which is an example of a structural homology?
void main(){ int a; a=1; while(a-->=1) while(a-->=0); printf("%d",a); }
Who invented bcpl language?
Explain about the functions strcat() and strcmp()?
regarding pointers concept
What is typeof in c?
What are the different types of errors?
How do you view the path?
Why are all header files not declared in every c program?
What is the time and space complexities of merge sort and when is it preferred over quick sort?
What are the primitive data types in c?