Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Ex12_TestNumbers
- {
- using System;
- public class Program
- {
- public static void Main(string[] args)
- {
- int N = int.Parse(Console.ReadLine());
- int M = int.Parse(Console.ReadLine());
- int max = int.Parse(Console.ReadLine());
- int sumMultiply = 0;
- int counter = 0;
- for (int i = N; i >= 1; i--)
- {
- for (int j = 1; j <= M; j++)
- {
- counter++;
- sumMultiply = sumMultiply + (3 * (i * j));
- if (sumMultiply >= max)
- {
- break;
- }
- }
- if (sumMultiply >= max)
- {
- break;
- }
- }
- if (sumMultiply >= max)
- {
- Console.WriteLine($"{counter} combinations");
- Console.WriteLine($"Sum: {sumMultiply} >= {max}");
- }
- else
- {
- Console.WriteLine($"{counter} combinations");
- Console.WriteLine($"Sum: {sumMultiply}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment