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 _06.NumberGenerator
- {
- class Program
- {
- 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());
- int num = M * 10;
- num += N;
- num *= 10;
- num += L;
- while (num >= 111)
- {
- if (specialNumber >= controlNumber)
- {
- break;
- }
- if (num % 3 == 0)
- {
- specialNumber += 5;
- }
- else if (num % 5 == 0)
- {
- specialNumber -= 2;
- }
- else if (num % 2 == 0 && num != 1)
- {
- specialNumber *= 2;
- }
- num--;
- }
- if (specialNumber < controlNumber)
- {
- Console.WriteLine($"No! {specialNumber} is the last reached special number.");
- }
- else
- {
- Console.WriteLine($"Yes! Control number was reached! Current special number is {specialNumber}.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement