The condition is( if weight and distance are 10kg and 5 miles Rs 50. If the weight is more than 10kg ie per 1kg Rs 5 and after 5 miles 1 mile to 10 mile rs 10. After 15 mile for every mile Rs.20. kindly tell me the condition how to write it.

Printable View

- 05-31-2007nksprakashc begginers
The condition is( if weight and distance are 10kg and 5 miles Rs 50. If the weight is more than 10kg ie per 1kg Rs 5 and after 5 miles 1 mile to 10 mile rs 10. After 15 mile for every mile Rs.20. kindly tell me the condition how to write it.

- 05-31-2007itsme86
Huh?

And what's an Rs? - 05-31-2007MacGyver
Bleh. I'm not working on that condition now. I think I need sleep first or something. lol.

What exactly do you need help with? - 05-31-2007svaidya
>>The condition is( if weight and distance are 10kg and 5 miles Rs 50. If the >>weight is more than 10kg ie per 1kg Rs 5 and after 5 miles 1 mile to 10 mile >>rs 10. After 15 mile for every mile Rs.20. kindly tell me the condition how to >>write it.

Code:`int weight ,distance;,cnt;`

int cntdistance;//might not need this

if (weight==10 &&distance==5){

Rs=50;

}

if(weight>10){

cnt=weight-10;

rs+=(5*cnt);

}

//assuming weight and distance are independent

if(distance>5&&distance<=15){

rs=10;

}

if(distance>15){

cntdistance=distance-15;

rs+=20*cntdistance;

}

- 05-31-2007PINGQuote:

The condition is( if weight and distance are 10kg and 5 miles Rs 50. If the weight is more than 10kg ie per 1kg Rs 5 and after 5 miles 1 mile to 10 mile rs 10. After 15 mile for every mile Rs.20. kindly tell me the condition how to write it.