# Thread: c begginers

1. ## 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.

2. Huh?

And what's an Rs?

3. 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?

4. >>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;

}

5. 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..

Popular pages Recent additions