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;
- namespace Vezba_5
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] numbers = new int[] {1, 5, 9, 2, 6};
- int max = FindLargestNum(numbers);
- Console.WriteLine("Najveci u nizu je {0}", max);
- Console.ReadKey();
- }
- static int FindLargestNum(int[] numbers)
- {
- int max = numbers[0];
- for (int i = 1; i<numbers.Length; i++)
- {
- if (max < numbers[i])
- {
- max = numbers[i];
- }
- }
- return max;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement