Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class MyProg
- {
- static void Main()
- {
- int maxnum = 0;
- Console.WriteLine("Input the size of the array");
- int ArSize = Convert.ToInt16(Console.ReadLine());
- int[] numbers = new int[ArSize];
- for (int i = 1; i < ArSize; i++)
- {
- Console.WriteLine("Write {0} element of array", i);
- try
- {
- numbers[i] = Convert.ToInt16(Console.ReadLine());
- }
- catch
- {
- Console.WriteLine("Please type only real numbers.");
- i -= 1;
- }
- }
- foreach (int ArEl in numbers)
- {
- if (maxnum < ArEl) {maxnum = ArEl;}
- }
- Console.WriteLine("maximum number in array is : {0}", maxnum);
- Console.ReadLine();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment