Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace КоледнаШапка
- {
- class Program
- {
- static void Main(string[] args)
- {
- var startNum = int.Parse(Console.ReadLine());
- var endNum = int.Parse(Console.ReadLine());
- var magicNum = int.Parse(Console.ReadLine());
- var count = 0;
- for (int a = startNum; a >= endNum; a--)
- {
- for (int b = startNum; b >= endNum; b--)
- {
- count++;
- if (a + b == magicNum)
- {
- Console.WriteLine($"Combination N:{count} ({a} + {b} = {a + b})");
- Environment.Exit(0);
- }
- }
- }
- Console.WriteLine($"{count} combinations - neither equals {magicNum}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment