프로그래밍(programming)
[백준 문제 1008]_자바 A/B
정보나눔중
2020. 11. 29. 00:51
반응형
단계별로 풀어보기
1단계 : 입출력과 사칙연산
-8단계 : 두 정수 a와 b를 입력받은 다음, a/b를 출력
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
import java.util.*;
class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
double a = sc.nextDouble();
double b = sc.nextDouble();
while(a<0 || a>10 || b<0 || b>10){
//System.out.println("a,b를 1~10 사이에 수로 입력해 주세요.");
a = sc.nextDouble();
b = sc.nextDouble();
}
System.out.println(a/b);
}
}
|
cs |
반응형