Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace dwdwdwdwDD
- {
- 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;
- var c = 0;
- for (int a = startNum; a <= endNum; a++)
- {
- for (int b = startNum; b <= endNum; b++)
- {
- c = a + b;
- count++;
- if (c == magicNum)
- {
- Console.Write($"Combination N:{count} ({a} + {b} = {c})");
- Environment.Exit(0);
- }
- }
- }
- Console.WriteLine($"{count} combinations - neither equals {magicNum}");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment