The if Statement
Hi
i want to swop the values of a and b if a < b:
if (a < b)
{
a = b;
b = a;
}
You'll need some temporary storage for data persistence.
1 2 3 4 5 6 7
|
if(a < b){
//Assuming data types are of integers.
int temp;
temp = b;
b = a;
a = temp;
}
|
a=a+b;
b=a-b;
a=a-b;
Thanx guys it really makes sense!
thanx again..
Topic archived. No new replies allowed.