CoDream

1257 : 두 수 사이의 홀수 출력하기 본문

JAVA/JAVA 예제

1257 : 두 수 사이의 홀수 출력하기

코잠 2024. 2. 16. 12:17
728x90
반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        for (; a <= b; a++) {
            if (a % 2 == 1) {
                System.out.print(a);
                System.out.print(" ");
            }
        }
    }
}
 
cs
728x90
반응형