티스토리 뷰

1063 : [기초-삼항연산] 두 정수 입력받아 큰 수 출력하기

import java.util.Scanner;

// 210125
// 1063 : [기초-삼항연산] 두 정수 입력받아 큰 수 출력하기

public class CU1063 {

    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();

        System.out.println((a>b) ? a : b);

        sc.close();
    }
}

 

1064 : [기초-삼항연산] 정수 3개 입력받아 가장 작은 수 출력하기

import java.util.Scanner;

// 210125
// 1064 : [기초-삼항연산] 정수 3개 입력받아 가장 작은 수 출력하기

public class CU1064 {

    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        System.out.println( (a>b ? b: a) > c ? c : (a>b ? b: a));

        sc.close();
    }
}

 

1065 : [기초-조건/선택실행구조] 정수 3개 입력받아 짝수만 출력하기

import java.util.Scanner;

// 210125
// 1065 : [기초-조건/선택실행구조] 정수 3개 입력받아 짝수만 출력하기

public class CU1065 {

    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if (a%2==0) System.out.println(a);
        if (b%2==0) System.out.println(b);
        if (c%2==0) System.out.println(c);

        sc.close();
    }
}

 

1066 : [기초-조건/선택실행구조] 정수 3개 입력받아 짝/홀 출력하기

import java.util.Scanner;

// 210125
// 1066 : [기초-조건/선택실행구조] 정수 3개 입력받아 짝/홀 출력하기

public class CU1066 {

    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();

        if (a%2==0) System.out.println("even");
        else System.out.println("odd");

        if (b%2==0) System.out.println("even");
        else System.out.println("odd");

        if (c%2==0) System.out.println("even");
        else System.out.println("odd");

        sc.close();
    }
}

 

1067 : [기초-조건/선택실행구조] 정수 1개 입력받아 분석하기

import java.util.Scanner;

// 210125
// 1067 : [기초-조건/선택실행구조] 정수 1개 입력받아 분석하기

public class CU1067 {

    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int num = sc.nextInt();

        if (num < 0) System.out.println("minus");
        else if (num > 0) System.out.println("plus");

        if (num%2==0) System.out.println("even");
        else System.out.println("odd");

        sc.close();
    }
}

 

1068 : [기초-조건/선택실행구조] 정수 1개 입력받아 평가 출력하기

import java.util.Scanner;

// 210125
// 1068 : [기초-조건/선택실행구조] 정수 1개 입력받아 평가 출력하기

public class CU1068 {

    public static void main (String[] args) {
        Scanner sc = new Scanner(System.in);

        int num = sc.nextInt();

        if (num >= 90) System.out.println("A");
        else if (num >= 70) System.out.println("B");
        else if (num >= 70) System.out.println("B");
        else if (num >= 40) System.out.println("C");
        else System.out.println("D");

        sc.close();
    }
}

 

1069 : [기초-조건/선택실행구조] 평가 입력받아 다르게 출력하기

import java.util.Scanner;

// 210125
// 1069 : [기초-조건/선택실행구조] 평가 입력받아 다르게 출력하기

public class CU1069 {

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		
		String str = sc.next();
		
		switch(str) {
			case "A": System.out.println("best!!!"); break;
			case "B": System.out.println("good!!"); break;
			case "C": System.out.println("run!"); break;
			case "D": System.out.println("slowly~"); break;
			default: System.out.println("what?"); break;
		}
		
		sc.close();
	}
}

 

1070 : [기초-조건/선택실행구조] 월 입력받아 계절 출력하기

import java.util.Scanner;

// 210125
// 1070 : [기초-조건/선택실행구조] 월 입력받아 계절 출력하기

public class CU1070 {

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int month = sc.nextInt();
		
		if (month==12 || month==1 || month==2) System.out.println("winter");
		else if (month==3 || month==4 || month==5) System.out.println("spring");
		else if (month==6 || month==7 || month==8) System.out.println("summer");
		else if (month==9 || month==10 || month==11) System.out.println("fall");
		
		sc.close();
	}
}

 

1071 : [기초-반복실행구조] 0 입력될 때까지 무한 출력하기1

import java.util.Scanner;

// 210125
// 1071 : [기초-반복실행구조] 0 입력될 때까지 무한 출력하기1

public class CU1071 {

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true) {			
			int num = sc.nextInt();
			if (num==0) break;
			System.out.println(num);
		}
		
		sc.close();
	}
}

 

1072 : [기초-반복실행구조] 정수 입력받아 계속 출력하기

import java.util.Scanner;

// 210125
// 1072 : [기초-반복실행구조] 정수 입력받아 계속 출력하기

public class CU1072 {

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int num = sc.nextInt();
		for (int i=0; i<num; i++) {
			System.out.println(sc.next());
		}
		
		sc.close();
	}
}

 

1073 : [기초-반복실행구조] 0 입력될 때까지 무한 출력하기2

import java.util.Scanner;

// 210125
// 1073 : [기초-반복실행구조] 0 입력될 때까지 무한 출력하기2

public class CU1073 {

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true) {
			int num = sc.nextInt();
			if (num==0) break;
			System.out.println(num);
		}
		
		sc.close();
	}
}

 

1074 : [기초-반복실행구조] 정수 1개 입력받아 카운트다운 출력하기1

import java.util.Scanner;

// 210125
// 1074 : [기초-반복실행구조] 정수 1개 입력받아 카운트다운 출력하기1

public class CU1074 {

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int num = sc.nextInt();
		for (int i=num; i>=1; i--) {
			System.out.println(i);
		}
		sc.close();
	}
}

 

1075 : [기초-반복실행구조] 정수 1개 입력받아 카운트다운 출력하기2

import java.util.Scanner;

// 210125
// 1075 : [기초-반복실행구조] 정수 1개 입력받아 카운트다운 출력하기2

public class CU1075 {

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int num = sc.nextInt();
		for (int i=num-1; i>=0; i--) {
			System.out.println(i);
		}
		sc.close();
	}
}

 

1076 : [기초-반복실행구조] 문자 1개 입력받아 알파벳 출력하기

import java.util.Scanner;

// 210125
// 1076 : [기초-반복실행구조] 문자 1개 입력받아 알파벳 출력하기

public class CU1076 {

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		
		char ch = sc.next().charAt(0);
		
		for (char c = 'a'; c<=ch; c++) {
			System.out.print(c + " ");
		}
		sc.close();
	}
}

 

1077 : [기초-반복실행구조] 정수 1개 입력받아 그 수까지 출력하기

import java.util.Scanner;

// 210125
// 1077 : [기초-반복실행구조] 정수 1개 입력받아 그 수까지 출력하기

public class CU1077 {

	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int num = sc.nextInt();
		
		for (int i=0; i<=num; i++) {
			System.out.println(i);
		}
		sc.close();
	}
}

 

100제 끝!!!!!

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/09   »
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
글 보관함