본문 바로가기

프로그래밍 문제/정올

(134)
540 : 반복제어문1 - 자가진단5 Java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = 0; while (num != -1){ num = sc.nextInt(); if ((num%3) == 0) System.out.println(num/3); if (num == -1) break; } } } Colored by Color Scripter cs
539 : 반복제어문1 - 자가진단4 Java 1234567891011121314151617181920212223import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = 0, sum = 0; int count = 0; double avg = 0; while (true){ num = sc.nextInt(); count++; sum += num; if (100
538 : 반복제어문1 - 자가진단3 Java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = -1; while (num != 0){ System.out.print("number? "); num = sc.nextInt(); if (0
537 : 반복제어문1 - 자가진단2 Java 1234567891011121314import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int max = sc.nextInt(); int sum = 0; for (int i=1; i
536 : 반복제어문1 - 자가진단1 Java 1 2 3 4 5 6 public class Main { public static void main(String[] args) { for (int i=1; i
124 : 선택제어문 - 형성평가5 Java 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 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int month = sc.nextInt(); switch (month){ case 1: case 3: case 5: case 7: case 8: case 10: case 12: System.out.println("31"); break; case 4: case 6: case 9: case 11: System.out.println("30");..
123 : 선택제어문 - 형성평가4 Java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.print("Number? "); int name = sc.nextInt(); switch (name){ case 1: System.out.println("dog"); break; case 2: System.out.println("cat"); break; case 3: System.out.println("chick"); break; default:..
122 : 선택제어문 - 형성평가3 Java 123456789101112131415import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int year = sc.nextInt(); if ((year%400) == 0) System.out.println("leap year"); else if (((year%4) == 0) && ((year%100) != 0)) System.out.println("leap year"); else System.out.println("common year"); }}Colored by Color Scriptercs
121 : 선택제어문 - 형성평가2 Java 123456789101112131415import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num = sc.nextInt(); if (num == 0) System.out.println("zero"); else if (0
120 : 선택제어문 - 형성평가1 Java 1 2 3 4 5 6 7 8 9 10 11 12 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num1 = sc.nextInt(); int num2 = sc.nextInt(); int result = (num1
632 : 선택제어문 - 자가진단9 Java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int num1 = sc.nextInt(); int num2 = sc.nextInt(); int num3 = sc.nextInt(); int min = (num1
535 : 선택제어문 - 자가진단8 Java 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); double num = sc.nextDouble(); switch ((int)num) { case 4: System.out.println("scholarship"); break; case 3: System.out.println("next semester"); break; case 2: System.out.println("seasonal semester"); break; d..