A storage container only contain one and a half metric ton of sugar one metric ton is approximately 1000 kg’s. Write a C++ program in which, take the amount of sugar in kg’s a bag can hold and the price of sugar (per KG). Calculate the number of bags needed to store one and a half metric ton sugar and the price of each bag.
#include <iostream>
using namespace std;
int main(){
int weight, price;
cout<<"Input the amount of sugar in Kg a bag can hold: ";
cin>>weight;
cout<<"Input the price per Kg of sugar: ";
cin>>price;
cout<<"The number of such bags needed to store one and a half metric tons is "<<1500 / weight;
cout<<"\nThe price per bag is "<<weight * price;
return 0;
}
Comments
Leave a comment