Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace MathPuzzle
- {
- class Program
- {
- static void Main(string[] args)
- {
- int key = int.Parse(Console.ReadLine());
- int count = 0;
- for (int a = 1; a <= 30; a++)
- {
- for (int b = 1; b <= 30; b++)
- {
- for (int c = 1; c <= 30; c++)
- {
- if ((a < b) && (b < c) && (a + b + c == key))
- {
- Console.WriteLine($"{a} + {b} + {c} = {key}");
- count++;
- }
- if ((a > b) && (b > c) && (a * b * c == key))
- {
- Console.WriteLine($"{a} * {b} * {c} = {key}");
- count++;
- }
- }
- }
- }
- if (count == 0) Console.WriteLine("No!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement