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 numbersGenerator
- {
- class Program
- {
- static void Main(string[] args)
- {
- int firstDigit = int.Parse(Console.ReadLine());
- int secondDigit = int.Parse(Console.ReadLine());
- int thirdDi git = int.Parse(Console.ReadLine());
- int specialNumber = int.Parse(Console.ReadLine());
- int controlNumber = int.Parse(Console.ReadLine());
- int number = firstDigit * 100 + secondDigit * 10 + thirdDigit;
- for (int i = number; i >= 111; i--)
- {
- if (i % 3 == 0)
- {
- specialNumber += 5;
- continue;
- }
- if (i % 10 == 5)
- {
- specialNumber -= 2;
- continue;
- }
- if (i % 2 == 0)
- {
- specialNumber *= 2;
- continue;
- }
- if (specialNumber >= controlNumber)
- {
- Console.WriteLine("Yes! Control number was reached! Current special number is {0}.", specialNumber);
- break;
- }
- }
- if (specialNumber < controlNumber)
- {
- Console.WriteLine("No! {0} is the last reached special number.", specialNumber);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment