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;
- namespace Excercise2
- {
- class Program
- {
- static void Main(string[] args)
- {
- int n;
- Console.Write("Please, enter the size of the array: ");
- string input = Console.ReadLine();
- n = int.Parse(input);
- int[] myArray;
- myArray = new int[n];
- EnterElements(myArray);
- PrintOddBiggerThat5(myArray);
- }
- static void EnterElements(int[] a)
- {
- for (int i = 0; i < a.Length; i++)
- {
- Console.Write("Please enter the value of myArray[{0}] = ", i);
- a[i] = int.Parse(Console.ReadLine());
- }
- }
- static void PrintOddBiggerThat5(int[] a)
- {
- for (int i = 0; i < a.Length; i++)
- {
- if (a[i] % 2 == 1 && a[i] > 5) Console.WriteLine(a[i]);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment