# c begginers

• 05-31-2007
nksprakash
c 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-2007
itsme86
Huh?

And what's an Rs?
• 05-31-2007
MacGyver
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-2007
svaidya
>>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-2007
PING
Quote:

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.
Show us something that you've written, stop posting homework questions here..