Answer to Question #178025 in C++ for Abdullah Ramzan

Question #178025

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.



1
Expert's answer
2021-04-03T09:46:46-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS