close

//16. 輸入一正整數, 判斷其奇偶.
import java.util.*;
public class Main {
public static void main(String args[])
{
String test;
Scanner scanner = new Scanner(System.in);
System.out.print("請輸入一正整數:");
test = scanner.next();
int i=Integer.parseInt(test);
if( i%2==0 )
{
System.out.print("是偶數");
}
else if( i%2!=0 )
{

System.out.print("是奇數");
}


}

}

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 萌新-工程師 的頭像
    萌新-工程師

    工程師的雜記

    萌新-工程師 發表在 痞客邦 留言(1) 人氣()