Answer to Question #335275 in C++ for red

Question #335275

F&W Sdn Bhd is a packaging company. Write a program in C++ to help the company  determines how many boxes that are needed for an item. For example, a box of shampoo can  have 30 bottles in it. So, 95 bottles of shampoo need to be packed into 3 boxes and 5 are left.  The number of each item and the number of an item that can be packed in a box are received  as inputs. Display the number of boxes needed and the number of leftover items. 




1
Expert's answer
2022-04-29T08:21:14-0400
#include <iostream>
 
using namespace std;
 
int main()
{
    int number_item, one_box, sum2 = 0;
    cout << "The number of each item: ";
    cin >> number_item;
    cout << "\nthe number of an item that can be packed in a box: ";
    cin >> one_box;
    cout << "\n######################################\n";
    cout << "#  The number of boxes needed: ";
    cout << number_item / one_box << "\t #\n";
    cout << "#  The number of leftover items: ";
    cout << number_item % one_box << "\t #\n";
    cout << "######################################\n";
 
    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