728x90
반응형
두 수의 합
/**
* 코딩테스트 입문 Day 1 사칙연산
* 두 수의 합
*/
public class Main1 {
public static void main(String[] args) {
System.out.println(solution(2, 3));
System.out.println(solution(100, 2));
}
public static int solution(int num1, int num2) {
return num1 + num2;
}
}
두 수의 차
/**
* 코딩테스트 입문 Day 1 사칙연산
* 두 수의 차
*/
public class Main2 {
public static void main(String[] args) {
System.out.println(solution(2, 3));
System.out.println(solution(100, 2));
}
public static int solution(int num1, int num2) {
return num1 - num2;
}
}
두 수의 곱
/**
* 코딩테스트 입문 Day 1 사칙연산
* 두 수의 곱
*/
public class Main3 {
public static void main(String[] args) {
System.out.println(solution(3, 4));
System.out.println(solution(27, 19));
}
public static int solution(int num1, int num2) {
return num1 * num2;
}
}
몫 구하기
/**
* 코딩테스트 입문 Day 1 사칙연산
* 몫 구하기
*/
public class Main4 {
public static void main(String[] args) {
System.out.println(solution(10, 5));
System.out.println(solution(7, 2));
}
public static int solution(int num1, int num2) {
return num1 / num2;
}
}
728x90
반응형
'📌Back-End > 프로그래머스' 카테고리의 다른 글
Java 프로그래머스 코딩테스트 입문 Day 3 사칙연산, 배열, 수학 (0) | 2024.06.24 |
---|---|
Java 프로그래머스 코딩테스트 입문 Day 2 사칙연산, 조건문, 배열 (0) | 2024.06.23 |
Java 프로그래머스 코딩 기초 트레이닝 Day 25 이차원 리스트(배열) (0) | 2024.06.21 |
Java 프로그래머스 코딩 기초 트레이닝 Day 24 조건문 활용, 반복문 활용, 이차원 리스트(배열) (0) | 2024.06.20 |
Java 프로그래머스 코딩 기초 트레이닝 Day 23 조건문 활용 (0) | 2024.06.19 |