write a program to swap Two numbers without using temp variable.
Answer Posted / sneha chorghade
#include<stdio.h>
void main()
{
int a=2,b=3;
printf("before swap the value is:::");
printf("a=%d\tb=%d",a,b);
a=a+b;
b=a-b;
a=a-b;
printf("after swap the value is:::");
printf("a=%d\tb=%d",a,b);
}
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What is a lookup table in c?
What is extern keyword in c?
What is pointer to pointer in c with example?
How can I get the current date or time of day in a c program?
an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational
Explain what is wrong in this statement?
What is a const pointer?
Can we declare variables anywhere in c?
Why does everyone say not to use gets?
What are the difference between a free-standing and a hosted environment?
What is assert and when would I use it?
What is the difference between test design and test case design?
How to declare a variable?
number of times a digit is present in a number
How can you call a function, given its name as a string?