일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
Tags
- GitHub
- Python
- dataframe
- keras
- LSTM
- index
- E-P1
- imread
- mariadb
- 삼성소프트웨어멤버십
- SciPy
- DFS
- mean
- synology
- Splunk
- javascript
- ipad
- pip
- Button
- install
- RNN
- pycharm
- pandas
- 알고리즘
- GT-S80
- SPL
- Numpy
- Series
- CNN
- Lotto
Archives
- Today
- Total
잠토의 잠망경
Ex4 본문
import java.util.Random; import java.io.*; public class ex4 { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub try{ BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); Random rnd=new Random(System.currentTimeMillis()); int mark=rnd.nextInt(200); int count=10; //루프 카운터 int inVal=0; //입력변수 System.out.print("랜덤수는 "+mark); while(count--!=0) //1회씩 줄여나간다. { System.out.print("값을 입력해주세요.: "); inVal = Integer.parseInt(in.readLine()); if(mark > inVal) { System.out.println("입력한 수는 기준 보다 작아요. "+count+"남았음"); } else if(mark < inVal) { System.out.println("입력한 수는 기준보다 커요."+count+"남았음"); } else if(mark == inVal) { System.out.println("Good 훌륭하네요.^^ 정답 "); break; } } if(mark == inVal) System.out.println("You win"); else System.out.println("You lose"); }catch(Exception e){System.out.println("error: "+e);} finally{ System.out.println("Game Over");} } }
Comments