vieną kartoninę dėžutę telpa n puodelių. Pakuotojas užklijuoja dėžutę ir išsiunčia ją į parduotuvę, jei ji pilna. Iš viso reikia supakuoti m puodelių. Parašykite programą, kuri apskaičiuotų, kelios bus pilnos dėžutės ir kiek puodelių liks nesupakuota.Natūralūs skaičiai n, m (1 ≤ n, m ≤ 106).Išveskite pilnų dėžių bei puodelių likučio kiekius.INPUT 3 7 OUTPUT pilnu 2 Nesupakuotu 1
Wed Oct 18 2023 20:12:53 GMT+0000 (Coordinated Universal Time)
Saved by
@AdomsNavicki
#include <iostream>
int main() {
int n, m;
// Prompt the user for the number of cups a box can hold and the total number of cups to pack
std::cout << "Enter the number of cups a box can hold (n): ";
std::cin >> n;
std::cout << "Enter the total number of cups to pack (m): ";
std::cin >> m;
// Calculate the number of full boxes and remaining cups
int fullBoxes = m / n;
int remainingCups = m % n;
// Display the results
std::cout << "Number of full boxes: " << fullBoxes << std::endl;
std::cout << "Number of cups left unpacked: " << remainingCups << std::endl;
return 0;
}
content_copyCOPY
Comments