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 Sum_Or__Multiplication
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool isFound = false;
- int controlNumber = int.Parse(Console.ReadLine());
- for (int i = 1; i <= 30; i++)
- {
- for (int j = 1; j <= 30; j++)
- {
- for (int k = 1; k <= 30; k++)
- {
- if (i < j && j < k && i + j + k == controlNumber)
- {
- isFound = true;
- Console.WriteLine("{0} + {1} + {2} = {3}", i, j, k, controlNumber);
- }
- if (i > j && j > k && i * j * k == controlNumber)
- {
- isFound = true;
- Console.WriteLine("{0} * {1} * {2} = {3}", i, j, k, controlNumber);
- }
- }
- }
- }
- if (isFound==false)
- {
- Console.WriteLine("No!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment