Advertisement
kreato

Untitled

Feb 5th, 2015
223
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.46 KB | None | 0 0
  1. using System;
  2. using System.Numerics;
  3. class ConsoleApplication1
  4. {
  5.     static void Main()
  6.     {
  7.         BigInteger product = 1;
  8.         BigInteger product2 = 1;
  9.         int counter = 0;
  10.         while (true)
  11.         {
  12.             string number = Console.ReadLine();
  13.             if (number == "END")
  14.             {
  15.                 if (counter <= 10)
  16.                 {
  17.                     Console.WriteLine(product);
  18.                 }
  19.                 else
  20.                 {
  21.                     Console.WriteLine("{0}\n{1}", product, product2);
  22.                 }
  23.                 return;
  24.             }
  25.             if (number == "0")
  26.             {
  27.                 continue;
  28.             }
  29.             if (counter % 2 != 0)
  30.             foreach (char symbol in number)
  31.             {
  32.                 if (counter <= 10)
  33.                 {
  34.                     if (symbol == '0')
  35.                     {
  36.                         continue;
  37.                     }
  38.                     else
  39.                     {
  40.                         product *= symbol - '0';
  41.                     }
  42.                 }
  43.                 else if (counter > 10)
  44.                 {
  45.                     if (symbol == '0')
  46.                     {
  47.                         continue;
  48.                     }
  49.                     else
  50.                     {
  51.                         product2 *= symbol - '0';
  52.                     }
  53.                 }
  54.             }
  55.             counter++;
  56.         }
  57.     }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement