[The cost of shipping is 3 KD (currency) for the 1st kilo and 1 KD for each additional kilo for the first 49 kilos; 1/2 KD for the rest. Write a program that reads the weight of the shipment (in kilos) and prints the cost of shipping in KD]
I just wanna know how to solve it like should I use the if statement or loop or what?
int kg, max;
double cost =0;
cout<< "The cost of shipping in KD is:"<<endl;
if (kg>0)
kg--;
cost+=3;
for (max = 49; kg>0; cost+=1;)
for (kg--; kg>0; cost+=0.5;)
return 0;