반응형
Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | 2 | |||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 |
| 10 | 11 | 12 | 13 | 14 | 15 | 16 |
| 17 | 18 | 19 | 20 | 21 | 22 | 23 |
| 24 | 25 | 26 | 27 | 28 | 29 | 30 |
| 31 |
Tags
- string
- c#
- math
- google apps script
- PANDAS
- Java
- django
- GIT
- Google Spreadsheet
- dataframe
- Kotlin
- matplotlib
- PostgreSQL
- Tkinter
- Apache
- list
- Google Excel
- numpy
- Python
- SQL
- hive
- gas
- 파이썬
- Excel
- Mac
- array
- Github
- Redshift
- PySpark
Archives
- Today
- Total
달나라 노트
C# : Math.Max, Math.Min(최대값, 최소값) 본문
728x90
반응형
C#에서 Math class는 다양한 수학적인 기능을 제공합니다.
Math.max는 최대값을 return해줍니다.
Math.min은 최소값을 return해줍니다.
using System;
class MyProgram
{
static void Main()
{
int value1 = 2;
int value2 = 3;
int result = Math.Max(value1, value2);
Console.WriteLine(result);
}
}
-- Result
3
max는 2개의 인자만을 받으며 2개의 인자 중 더 큰 값을 return합니다.
using System;
class MyProgram
{
static void Main()
{
int value1 = 2;
int value2 = 3;
int result = Math.Min(value1, value2);
Console.WriteLine(result);
}
}
-- Result
2
min은 2개의 인자만을 받으며 2개의 인자 중 더 작은 값을 return합니다.
728x90
반응형
'C# > C#' 카테고리의 다른 글
| C# : Math.Abs (절대값) (0) | 2022.03.23 |
|---|---|
| C# : Math.Sqrt (제곱근) (0) | 2022.03.23 |
| C# : &&, ||, ~ (논리 연산자, and, or, not) (0) | 2022.03.23 |
| C# : ReadLine, Convert (user input 받기, 자료형 변환) (0) | 2022.03.23 |
| C# : 변수와 자료형 (variable and data type) (0) | 2022.03.23 |
Comments