티스토리 뷰

 

 

 

Lv0. a와 b출력하기

c언어와 java 버전으로 풀이 올립니당

 

#include <stdio.h>

int main(void) {  //c
    int a;
    int b;
    scanf("%d %d", &a, &b);
    if((a<-100000) || (a>100000)){
        printf(" A is out of range.");
        return -1;
    }
    if ((b< -100000) || (b>100000)){
        printf(" B is out of range.");
        return -1;
    }
    printf("a = %d\n", a);
    printf("b = %d\n", b);
    return 0;
}

solution.c

 

 

 

 

 

 

import java.util.Scanner;

public class Solution {  //java
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        

        System.out.println("a = " + a);
        System.out.println("b = " + b);
    } 
}

solution.java

 

 

 

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