[Snow-ball]프로그래밍(컴퓨터)/java
랜덤한 숫자를 출력하는 방법
Snow-ball
2020. 12. 17. 15:20
반응형
1
2
3
4
5
6
7
8
9
10
11
12
|
package Fourth;
public class FourthRandom {
public static void main(String[] args) {
System.out.printf("0.0 ~ 1.0 사이의 랜덤 = %f\n", Math.random());
System.out.printf("0 ~ 10 사이의 랜덤 = %d\n", (int)(Math.random() * 10));
System.out.printf("0 ~ 100 사이의 랜덤 = %d\n", (int)(Math.random() * 100));
}
}
|
cs |
인테리어소품 베타존 : 네이버쇼핑 스마트스토어
나를 꾸미다 - 인테리어소품 베타존
smartstore.naver.com
반응형