write a program to swap Two numbers without using temp variable.

Answer Posted / ravi saini

void main()
{
int a,b;
printf("enter the two numbers");
scanf("%d%d",&a,&b);
a^=b^=a^=b;
printf("%d%d",a,b);//swapped no
}

Is This Answer Correct ?    119 Yes 66 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are run-time errors?

600


How to write a multi-statement macro?

626


Write a program to swap two numbers without using a temporary variable?

612


Why is void main used?

621


which is conditional construct a) if statement b) switch statement c) while/for d) goto

740






main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }

920


Explain about block scope in c?

663


How many types of operators are there in c?

620


which of the following shows the correct hierarchy of arithmetic operations in C a) (), **, * or/,+ or - b) (),**,*,/,+,- c) (),**,/,*,+,- d) (),/ or *,- or +

1186


What is function pointer c?

586


Why doesnt long int work?

614


why return type of main is not necessary in linux

1707


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

583


What do you mean by command line argument?

647


Explain what is wrong with this program statement? Void = 10;

766