일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- CSS
- java
- rails7
- ruby
- C로 시작하는 컴퓨터 프로그래밍4판
- 연습문제
- 디지몬
- javascript
- 비즈니스일본어
- 日本語
- 一日一つメソッド
- 単語
- Python
- vscode
- 건담
- メソッド
- 인프런
- springboot
- 반다이몰
- Flutter
- 건담베이스
- 자바
- Web
- Spring
- nico
- jsp
- rails
- 일본어
- html
- DART
Archives
- Today
- Total
목록Java로또 (1)
AR삽질러

Java 로또번호 자동생성기 만들기 1. 1부터 45까지의 숫자 중에서 중복되는 번호 없이 6개의 숫자를 랜덤하게 생성한다. 번호를 두번돌려 중복이 없는 숫자를 찾는다. public class Lotto { public static void main(String[] args) { // 로또번호자동 생성기 // 1부터 45까지의 숫자 중에서 중복 없이 6개의 숫자를 랜덤하게 생성 Random random = new Random(); // 랜덤객체 int[] lottoNumber = new int[6]; for(int i = 0; i < 6; i++) { int number = random.nextInt(45)*1; for(int j = 0; j < i; j++) { if(lottoNumber[j] == n..
JAVA
2023. 2. 22. 16:28