?? pro_5.java
字號:
package com.jk;
import java.io.* ;
/**
*
* @author 王榮華
* @date 2008-7-17
*
*/
class BasicIo
{
public static int readInteger() throws IOException
{
String line ;
BufferedReader in = new BufferedReader(new
InputStreamReader(System.in)) ;
try
{
line = in.readLine() ;
int i = Integer.parseInt(line.trim()) ;
return i ;
}
catch (Exception e)
{
throw new IOException("invalid integer") ;
}
} // end of method readInteger
}
public class pro_5
{
public static void main(String[] args)
{
System.out.println("輸入3位整數");
int c;
try
{
c=BasicIo.readInteger();
}
catch(Exception e)
{
System.out.println(e);
c=0;
System.exit(1);
}
if((c/100)==0||(c/100)>9)System.out.println("不是3位數!");
boolean ji=false;
boolean ou=false;
if((c/100)%2==0)ou=true;
else ji=true;
if((c/10)%2==0)ou=true;
else ji=true;
if((c%2)==0)ou=true;
else ji=true;
if(ou==ji)System.out.println("同時存在基數和偶數");
else System.out.println("不同時存在基數和偶數");
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -