일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- https://minkwon4.tistory.com/161
- 국회의원 & 높으신 분들 어록
- https://tecoble.techcourse.co.kr/post/2021-08-07-logback-tutorial/
- Today
- Total
목록My story (831)
OPEN between Secret
import java.util.Random; import java.util.Scanner; public class CardGame { public static void main (String [] args) { Random rd = new Random(); Scanner sc = new Scanner(System.in); while(true) { int low = 0; int high = 99; int i = 1 ,num = 0; int card = rd.nextInt(100); System.out.println("수를 결정하였습니다. 맞추어보세요"); if(num >high || num < low){ System.out.println("범위를 벗어났습니다."); } else { while(true) {..
public class ArrayException { public static void main (String [] args){ int [] intArray = new int[5]; intArray[0] = 0; try { for (int i = 0 ; i < 5 ; i ++) { intArray[i+1] = i+1 + intArray[i]; System.out.println("intArray["+i+"]" + "=" + intArray[i]); } } catch(ArrayIndexOutOfBoundsException e) { System.out.println("배열의 인덱스가 범위를 벗어났습니다."); } } } --------------------------------------------------..
import java.util.Scanner; public class ExceptionExcample1 { public static void main (String [] args) { Scanner sc = new Scanner(System.in); int divisor = 0; int dividend = 0; System.out.print("나뉨수를 입력하시오 :"); dividend = sc.nextInt(); System.out.print("나눗수를 입력하시오:"); divisor = sc.nextInt(); try { System.out.println(dividend/divisor); } catch (ArithmeticException e) { System.out.println("0으로 나눌 수 ..
import java.util.Scanner; public class maytoone { public static void main (String [] args){ Scanner sc = new Scanner(System.in); int intArray [] = new int[5]; double sum = 0; for( int i = 0 ; i
import java.util.Scanner; public class maytoone { public static void main( String [] args){ Scanner sc = new Scanner(System.in); int inArray[] = new int [5]; int max = 0; for ( int i = 0 ; i max) max = inArray[i]; } System.out.println("입력된 수에서 가장 큰 수는" + max + "입니다."); } } -------------------------------------------------------------- inArray[i] = sc.nextInt(); 생성된 배열에다가 입력받은거 한개씩 저장하는방법 이다.(이게 ..
public class maytoone { public static void main (String[] args) { char al = 'a'; do { System.out.print(al); al = (char) (al + 1) ; } while (al
import java.util.Scanner; public class maytoone { public static void main (String [] args){ Scanner sc = new Scanner(System.in); int n = 0; double sum = 0; int i = 0; while ((i = sc.nextInt()) !=0){ sum = sum + i; n++; } System.out.println("입력된 수의 개수는" + n + "개이며 평균은 " + sum /n + "입니다."); } } -------------------------------------------------------------------------------- 입력된 숫자들을 표시해주고 (i = sc...
public class maytoone { public static void main(String [] args) { int i , j ; for (j = 0,i = 1; i
import java.util.*; public class maytoone { public static void main(String[] args) { int a = 0; String chal, yung ; Scanner sc = new Scanner(System.in); System.out.println("가위 바위 보 게임입니다. 가위, 바위, 보 중에서 입력하세요"); System.out.println("철수"); chal = sc.next(); System.out.println("영희"); yung = sc.next(); if(chal.equals("바위") == yung.equals("바위") && chal.equals("가위") == yung.equals("가위") && chal.equals(..