101k views
4 votes
Write a program that will read the weight of a package of breakfast cereal in ounces and output the weight in metric tons as well as the number of boxes needed to yield one metric ton of cereal. In: A metric ton is 35,273.92 ounces.

1 Answer

2 votes

Answer:

The C++ code is given below

Step-by-step explanation:

#include <iostream>

using namespace std;

int main () {

int flag=1;

do{

double ounce,metric,boxes;

cout<<"Enter weight of package in ounces: ";

cin>>ounce;

metric=ounce/35273.92;

cout<<"Metric ton is "<<metric<<endl;

boxes=35273.92/ounce;

cout<<"Number of boxes are: "<<boxes<<endl;

cout<<"Press 0 to quit else press 1: ";

cin>>flag;

}while(flag==1);

return 0;

}

User AdamZ
by
5.1k points