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

Answer Posted / biren

#include<stdio.h>
void main()
{
int a=2,b=3;
printf("before swap the value is:::");
printf("a=%d\tb=%d",a,b);
b=a+b-(a=b);
printf("after swap the value is:::");
printf("a=%d\tb=%d",a,b);
}

Is This Answer Correct ?    3 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a ternary operator in c?

646


write a programming in c to find the sum of all elements in an array through function.

1698


A function can make the value of a variable available to another by a) declaring the variable as global variable b) Passing the variable as a parameter to the second function c) Either of the two methods in (A) and (B) d) binary stream

660


Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

593


What are the application of c?

637






What are conditional operators in C?

616


When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.

1520


Can you write the function prototype, definition and mention the other requirements.

651


Are bit fields portable?

669


Why is structure important for a child?

599


Tell us two differences between new () and malloc ()?

608


What is the difference between class and object in c?

572


How can I prevent another program from modifying part of a file that I am modifying?

605


How to delete a node from linked list w/o using collectons?

2081


What are the differences between Structures and Arrays?

599