Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Numerics;
- class ConsoleApplication1Exam15i16
- {
- static void Main(string[] args)
- {
- string input = "";
- int count = 0;
- List<string> array = new List<string>();
- while (true)
- {
- input = Console.ReadLine().ToUpper();
- if (input == "END")
- {
- break;
- }
- if (count % 2 != 0)
- {
- array.Add(input);
- }
- count++;
- }
- BigInteger sum = 1;
- BigInteger sum2 = 1;
- if (count < 10)
- {
- for (int i = 0; i <= array.Count - 1; i++)
- {
- foreach (var symbol in array[i])
- {
- int number = symbol - '0';
- if (number != 0)
- {
- sum *= (BigInteger)number;
- }
- else
- {
- sum *= 1;
- }
- }
- }
- Console.WriteLine(sum);
- }
- else
- {
- for (int i = 0; i <= array.Count - 1; i++)
- {
- if (i <= 4)
- {
- foreach (var symbol in array[i])
- {
- int number = symbol - '0';
- if (number != 0)
- {
- sum *= (BigInteger)number;
- }
- else
- {
- sum *= 1;
- }
- }
- }
- else
- {
- foreach (var symbol in array[i])
- {
- int number = symbol - '0';
- if (number != 0)
- {
- sum2 *= (BigInteger)number;
- }
- else
- {
- sum2 *= 1;
- }
- }
- }
- }
- Console.WriteLine(sum);
- Console.WriteLine(sum2);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement