Advertisement
nahidjamalli

Lesson #7

Mar 25th, 2020
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. namespace MyNamespace
  2. {
  3.     class Program
  4.     {
  5.         static void Main()
  6.         {
  7.             int max = int.MinValue;
  8.             int[] arr = new int[5] { 2, 35, 6, 8, 9 };
  9.  
  10.             for (int i = 0; i < arr.Length; i++)
  11.             {
  12.                 if (arr[i] > max)
  13.                 {
  14.                     max = arr[i];
  15.                 }
  16.             }
  17.  
  18.             System.Console.Write("max: ");
  19.             System.Console.WriteLine(max);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement