Advertisement
Guest User

Untitled

a guest
Mar 19th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.12 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Q06_Number_Generator
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int huns = int.Parse(Console.ReadLine());
  14.             int tenz = int.Parse(Console.ReadLine());
  15.             int ones = int.Parse(Console.ReadLine());
  16.  
  17.             int hundreds = huns * 100;
  18.             int tens = tenz * 10;
  19.  
  20.             int startingNumber = hundreds + tens + ones;
  21.  
  22.             int specialNumber = int.Parse(Console.ReadLine());
  23.             int controlNumber = int.Parse(Console.ReadLine());
  24.  
  25.             for (int i = startingNumber; i >= 111; i--)
  26.             {
  27.                 if (specialNumber >= controlNumber)
  28.                 {
  29.                     Console.WriteLine($"Yes! Control number was reached! Current special number is {specialNumber}.");
  30.                     break;
  31.                 }
  32.  
  33.                 if (i % 3 == 0)
  34.                 {
  35.                     specialNumber += 5;
  36.  
  37.                     if (i == 111)
  38.                     {
  39.                         Console.WriteLine($"No! {specialNumber} is the last reached special number.");
  40.                         break;
  41.                     }
  42.                     else
  43.                     { continue; }
  44.                 }
  45.                 else if (i % 10 == 5)
  46.                 {
  47.                     specialNumber -= 2;
  48.  
  49.                     if (i == 111)
  50.                     {
  51.                         Console.WriteLine($"No! {specialNumber} is the last reached special number.");
  52.                         break;
  53.                     }
  54.                     else
  55.                     { continue; }
  56.                 }
  57.                 else if (i % 2 == 0)
  58.                 {
  59.                     specialNumber *= 2;
  60.  
  61.                     if (i == 111)
  62.                     {
  63.                         Console.WriteLine($"No! {specialNumber} is the last reached special number.");
  64.                         break;
  65.                     }
  66.  
  67.                  
  68.                 }
  69.  
  70.  
  71.  
  72.  
  73.             }
  74.         }
  75.  
  76.     }
  77. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement