Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace OddAndEvenProducts
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int[] array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- int oddSum = 1;
- int evenSum = 1;
- for (int i = 1; i < n; i++)
- {
- if (i % 2 == 1)
- {
- oddSum *= array[i];
- }
- else
- {
- evenSum *= array[i -1];
- }
- }
- if (evenSum == oddSum)
- {
- Console.WriteLine($"yes {evenSum}");
- }
- else
- {
- Console.WriteLine($"no {oddSum} {evenSum}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement