Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int number_of_ones, number_of_twos, number_of_fives, total;
- cin >> number_of_ones >> number_of_twos >> number_of_fives >> total;
- for (int ones = 0; ones <= number_of_ones; ones++)
- {
- for (int twoes = 0; twoes <= number_of_twos; twoes++)
- {
- for (int fives = 0; fives <= number_of_fives; fives++)
- {
- int current_total = ones * 1 + twoes * 2 + fives * 5;
- if (total == current_total)
- {
- printf("%d * 1 lv. + %d * 2 lv. + %d * 5 lv. = %d lv.",
- ones, twoes, fives, total);
- cout << endl;
- }
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement