최대값 구하는 알고리즘


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
            using System;
 
              public class 최대값
              {
                  public static void Main()
                  {

                      
                      int[] data = { 16924, 18 };
                      int max = data[0];
                            
//여기가 최대값 구하는 알고리즘
                      for (int i = 0; i < data.Length; i++)
                      { 
                          if(max < data[i])
                          {
                              max = data[i];
                          }
                      }
 
                              
                      Console.WriteLine("최대값 : {0}", max); ;
                  }    
              }

//cs


'C#' 카테고리의 다른 글

C# using 쓰는 이유  (0) 2019.01.31
엑셀 다루기  (0) 2019.01.30
C# 최소값 구하기(알고리즘)  (0) 2019.01.30

+ Recent posts