using System; namespace _12._Test_Numbers { class Program { static void Main(string[] args) { //Write a program, which finds all the possible combinations between two numbers – N and M. //The first digit decreases from N to 1, and the second digit increases from 1 to M. The two digits form a number. Multiply //the two digits, then multiply their product by 3. Add the result to the total sum. //You will also be given a third number, which will be the maximum boundary of the sum. If the sum is equal or greater than //this number you should stop the program. See the examples for further information. int n = int.Parse(Console.ReadLine()); int m = int.Parse(Console.ReadLine()); int maxSum = int.Parse(Console.ReadLine()); int count = 0; int sum = 0; for (int i = n; i >= 1; i--) { for (int k = 1; k <= m; k++) { sum += i * k * 3; count++; if (sum >= maxSum) { Console.WriteLine($"{count} combinations"); Console.WriteLine($"Sum: {sum} >= {maxSum}"); return; } } } Console.WriteLine($"{count} combinations"); Console.WriteLine($"Sum: {sum}"); return; } } }