SWEA 5549 홀수일까 짝수일까

1 개요[ | ]

SWEA 5549 홀수일까 짝수일까
SW Expert 아카데미
# 문제 풀이

틀:SWEA 난이도 3-2

2 C++[ | ]

3 Java[ | ]

import java.util.*;
class Solution {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int T=sc.nextInt();
        String numStr;
        int remainder;
        for(int tc= 1; tc<= T; tc++) {
            numStr = sc.next();
            remainder = (numStr.charAt(numStr.length()-1)-48)%2;
            System.out.format("#%d ", tc);
            if( remainder == 0 ) System.out.println("Even");
            else System.out.println("Odd");
        }
        sc.close();
    }
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}