본문 바로가기
알고리즘/백준

[백준 1008번 ː 자바(JAVA)] A/B

by 그릿er 2020. 4. 14.

<문제>

 

두 정수 A와 B를 입력받은 다음, A/B를 출력하는 프로그램을 작성하시오.

 

 

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
import java.util.Scanner;
 
public class Main {
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        sc.close();
        System.out.println((double)a/b);
    }
 
}
 
 

 

 

* double을 넣음으로써 소수점이 출력될 수 있게 해 줍니다.