<문제 설명>


<나의 풀이>

<다른사람 풀이>
1)
using System;
public class Solution {
public int solution(int num1, int num2) {
return num1 == num2 ? 1 : -1;
}
}
2)
using System;
public class Solution {
public int solution(int num1, int num2) {
int answer = 1;
if(num1 != num2) answer *= -1;
return answer;
}
}
3)
using System;
public class Solution
{
public int solution(int num1, int num2)
{
int answer = 0;
if(num1 == num2)
{
answer = 1;
}
else if(num1 != num2)
{
answer = -1;
}
return answer;
}
}'하루회고 ( *ฅ́˘ฅ̀*) > 프로그래머스 (๑ ́ᄇ`๑)' 카테고리의 다른 글
| C#)나이 출력 (0) | 2024.06.08 |
|---|---|
| C#)나머지 구하기 (0) | 2024.06.07 |
| C#)몫 구하기 (0) | 2024.06.05 |
| C#)두 수의 곱 (0) | 2024.06.04 |
| C#) 두 수의 차 (0) | 2024.06.04 |