본문 바로가기

728x90
반응형

프로그래밍/자바

(113)
[자바] 정올 130 ~ 139 : 반복제어문2 - 형성평가1 ~ 10 형성평가1 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); for (int i = 0; i < a; i++) System.out.println("JUNGOL"); } } 형성평가2 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(), b = sc.nextInt(); int min = a < ..
[자바] 정올 541 ~ 548 : 반복제어문2 - 자가진단 1 ~ 8 자가진단1 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); String a = sc.nextLine(); System.out.println(a.repeat(20)); } } 자가진단2 public class Main { public static void main(String[] args) { for(int i = 10; i
[자바] 정올 129 : 반복제어문1 - 형성평가5 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int base, height; char contin = 'y'; while(contin == 'y' || contin == 'Y'){ System.out.print("Base = "); base = sc.nextInt(); System.out.print("Height = "); height = sc.nextInt(); System.out.printf("Triangle width = %.1f\n", (double)(base*height)/2); sc.nextLine(); System.o..
[자바] 정올 128 : 반복제어문1 - 형성평가4 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i, sum=0, count = 0; while(true){ i = sc.nextInt(); if(!(i >= 0 && i
[자바] 정올 127 : 반복제어문1 - 형성평가3 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i, sum=0, count = 0; while(true){ i = sc.nextInt(); if(!(i >= 0 && i
[자바] 정올 126 : 반복제어문1 - 형성평가2 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int even = 0; int odd = 0; int i; while(true){ i = sc.nextInt(); if(i==0) break; if(i % 2 == 0) even++; else odd++; } System.out.println("odd : " + odd); System.out.println("even : " + even); } }
[자바] 정올 125 : 반복제어문1 - 형성평가1 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int a = sc.nextInt(); for(int i = 1; i
[자바] 정올 633 : 반복제어문1 - 자가진단6 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int i; boolean a = true; while(a){ System.out.print("1. Korea\n" + "2. USA\n" + "3. Japan\n" + "4. China\n" + "number? "); i = sc.nextInt(); switch(i){ case 1: System.out.println("\nSeoul"); break; case 2: System.out.println("\nWashington"); break; case 3: System.out.printl..

728x90
반응형