One metric ton is approximately 2205 pounds. Write a program that prompts the user to input the amount of rice, in pounds, in a bag. The program outputs the number of bags needed to store one metric ton of rice.
Write the Code:
/*
Project: Ton of Rice
Description: User inputs how many pounds of rice are in a bag.
Program calculates the number of bags needed for 1 ton of rice.
*/
#include <iostream>
using namespace std;
int main()
{
float pounds = 0;
float bagsInTon = 0;
cout << "Please enter the number of pounds in each rice bag:";
cin >> pounds;
bagsInTon = 2205 / pounds;
cout << "\nYou need " << bagsInTon << " bags for each ton of rice.";
return 0;
}