728x90
반응형
SMALL
자가진단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 <=20; i++) System.out.print(i + " ");
}
}
자가진단3
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 <= a; i++) if(i%2 == 0) System.out.print(i + " ");
}
}
자가진단4
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int sum = 0;
for(int i = a; i<=100;i++) sum += i;
System.out.println(sum);
}
}
자가진단5
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int i, m3 = 0, m5= 0;
for(int a = 0; a < 10; a++){
i=sc.nextInt();
if(i%3 == 0) m3++;
if(i%5 == 0) m5++;
}//end for
System.out.println("Multiples of 3 : " + m3);
System.out.println("Multiples of 5 : " + m5);
}
}
자가진단6
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
double sum = 0;
int n = sc.nextInt();
for(int i = 0; i < n; i++) sum += sc.nextInt();
System.out.printf("avg : %.1f\n", sum/n);
if(sum/n >= 80) System.out.println("pass");
else System.out.println("fail");
}
}
자가진단7
public class Main {
public static void main(String[] args) {
for (int i = 2; i <= 6; i++) {
for(int j = 0; j < 5; j++){
System.out.print((i+j) + " ");
}
System.out.println();
}
}
}
자가진단8
public class Main {
public static void main(String[] args) {
for(int i =2; i <= 4; i++){
for(int j = 1; j <= 5; j++){
System.out.printf("%-2d*%2d =%3d ", i,j,i*j);
}
System.out.println();
}
}
}
728x90
반응형
LIST
'프로그래밍 > 자바' 카테고리의 다른 글
[자바] 정올 549 ~ 553 && 634 : 반복제어문3 - 자가진단 1 ~ 7 (0) | 2023.09.27 |
---|---|
[자바] 정올 130 ~ 139 : 반복제어문2 - 형성평가1 ~ 10 (0) | 2023.09.26 |
[자바] 정올 129 : 반복제어문1 - 형성평가5 (0) | 2023.09.25 |
[자바] 정올 128 : 반복제어문1 - 형성평가4 (0) | 2023.09.25 |
[자바] 정올 127 : 반복제어문1 - 형성평가3 (0) | 2023.09.24 |