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 NumberGenerator
- {
- class NumberGenerator
- {
- static void Main(string[] args)
- {
- int m = int.Parse(Console.ReadLine());
- int n = int.Parse(Console.ReadLine());
- int l = int.Parse(Console.ReadLine());
- int specialNumber = int.Parse(Console.ReadLine());
- int controlNumber = int.Parse(Console.ReadLine());
- bool result1;
- bool result2 = false;
- for (int i = m; i >= 1; i--)
- {
- for (int j = n; j >= 1; j--)
- {
- for (int k = l; k >= 1; k--)
- {
- int sum = i + j + k;
- result1 = false;
- if (sum % 3 == 0 && !result1)
- {
- specialNumber += 5;
- result1 = true;
- }
- else if (sum % 10 == 5 && !result1)
- {
- specialNumber -= 2;
- result1 = true;
- }
- else if (sum % 2 == 0 && !result1)
- {
- specialNumber *= 2;
- }
- if (specialNumber >= controlNumber)
- {
- Console.WriteLine("Yes! Control number was reached! Current special number is "
- + specialNumber + ".");
- result2 = true;
- break;
- }
- }
- if (result2)
- {
- break;
- }
- }
- if (result2)
- {
- break;
- }
- }
- if (!result2)
- {
- Console.WriteLine("No! {0} is the last reached special number.", specialNumber);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement