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