Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- class OddAndEvenProduct
- {
- static void Main()
- {
- int odd = 1;
- int even = 1;
- string input = Console.ReadLine();
- string[] spaces = input.Split(' ');
- int[] array = new int[spaces.Length];
- for (int i =0; i < array.Length; i++)
- {
- array[i] = int.Parse(spaces[i]);
- if (i % 2 == 0)
- {
- odd *= array[i];
- }
- if (i % 2 == 1)
- {
- even *= array[i];
- }
- }
- if (even == odd)
- {
- Console.WriteLine("Yes");
- Console.WriteLine("product = {0}", odd);
- }
- else
- {
- Console.WriteLine("No");
- Console.WriteLine("odd_product = {0}", odd);
- Console.WriteLine("even_product = {0}", even);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement