MuffinMonster

Class Task 20#

Oct 25th, 2013
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.59 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace ConsoleApplication1
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.             int input, temp;
  13.             int digits = 0;
  14.             Random r = new Random();
  15.             input = r.Next(10, 1000001);
  16.             while (input == 999)
  17.             {
  18.                 input = r.Next(10, 1000001);
  19.             }
  20.             while (input != 999)
  21.             {
  22.                 Console.WriteLine(input);
  23.                 temp = input;
  24.                 while (temp > 0)
  25.                 {
  26.                     temp = temp / 10;
  27.                     digits++;
  28.                 }
  29.                 if (digits % 2 != 0)
  30.                     Console.WriteLine("Izugi!");
  31.                 else if (digits == 2)
  32.                 {
  33.                     Console.WriteLine("Zugi!");
  34.                     digits = input % 100;
  35.                     Console.WriteLine("Middle numbers are: " + digits);
  36.                 }
  37.                 else
  38.                 {
  39.                     Console.WriteLine("Zugi!");
  40.                     digits = (digits / 2) - 1;
  41.                     while (digits > 0)
  42.                     {
  43.                         input = input / 10;
  44.                         digits--;
  45.                     }
  46.                     input = input % 100;
  47.                     Console.WriteLine("Middle numbers are: " + input);
  48.                 }
  49.                 input = r.Next(10, 1000001);
  50.                 digits = 0;
  51.  
  52.             }
  53.             Console.ReadKey();
  54.          }
  55.     }
  56. }
Add Comment
Please, Sign In to add comment