Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Program
- {
- class Program
- {
- public static int max(int[] pole)
- {
- //max je nejnizsi mozna hodnota z randomu
- int max = -100;
- for (int j = 0; j < pole.Length; j++)
- {
- if (pole[j] > max)
- max = pole[j];
- }
- return max;
- }
- public static void Main(string[] args)
- {
- Random random = new Random();
- int[] pole = new int[5];
- for (int i = 0; i < 5; i++)
- {
- pole[i] = random.Next(-100, 100);
- }
- //vypsani pole pro kontrolu
- for (int i = 0; i < 5; i++)
- {
- Console.Write(pole[i] + " ");
- }
- Console.WriteLine("\nNejvyšší číslo je {0}. ", max(pole));
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment