Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace OddEqualsEven
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n = int.Parse(Console.ReadLine());
- int[] numbers = new int[n];
- for (int i = 0; i < n; i++)
- {
- numbers[i] = int.Parse(Console.ReadLine());
- }
- int productOdd = 1, productEven = 1;
- for (int i = 0; i < numbers.Length; i++)
- {
- if (i % 2 == 0)
- {
- productOdd *= numbers[i];
- }
- else
- {
- productEven *= numbers[i];
- }
- }
- if (productEven == productOdd)
- {
- Console.WriteLine("yes {0}", productEven);
- }
- else
- {
- Console.WriteLine("no {0} {1}", productOdd, productEven);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement