์ ๋ ฅ๋ฐ๋ ์์ ๋ฒ์๊ฐ ๊ธธ์์์ด์, ๊ทธ๋ฅ string์ผ๋ก ์ ๋ ฅ๋ฐ๊ณ ๋์
๋ฌธ์์ด์ ๋ง์ง๋ง ์๋ฆฌ๋ง temp์ ๋ด์ ์ง์์ธ์ง, ํ์์ธ์ง ํ๋ณ
import java.util.Scanner;
class Solution{
public static void main(String args[]) throws Exception{
Scanner kb=new Scanner(System.in);
int T=kb.nextInt();
for(int test_case=1; test_case<=T; test_case++){
String s=kb.next();
int temp=Character.getNumericValue(s.charAt(s.length()-1));
if(temp%2!=0) System.out.println("#"+test_case+" "+"Odd");
else System.out.println("#"+test_case+" "+"Even");
}
}
}
'๐ ์ฝ๋ฉํ ์คํธ > ๋ฐฑ์ค & ํ๋ก๊ทธ๋๋จธ์ค' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[SWEA][JAVA]D3 : [S/W ๋ฌธ์ ํด๊ฒฐ ๊ธฐ๋ณธ] 4์ผ์ฐจ - ๊ฑฐ๋ญ ์ ๊ณฑ (0) | 2022.11.07 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค][JAVA]Level 0 : 2์ฐจ์์ผ๋ก ๋ง๋ค๊ธฐ (0) | 2022.11.07 |
[SWEA][JAVA]D3 : 100๋ง ์ดํ์ ๋ชจ๋ ์์ (0) | 2022.11.05 |
[ํ๋ก๊ทธ๋๋จธ์ค][JAVA]Level 1 : ํธ๋ ํ์ดํฐ ๋ํ (0) | 2022.11.05 |
[ํ๋ก๊ทธ๋๋จธ์ค][JAVA]Level 0 : ์ปจํธ๋กค ์ ํธ (1) | 2022.11.05 |