public class test {
public static void main(String args[]) {
// 输出5行
for (int i = 0; i < 5; i++) {
// 输出4列
for (int j = 1; j < 5; j++) {
// 当i==0时输出标题栏
if (i == 0) {
// 过滤j=1的时候输出1*N的这种情况
if (j - 1 == 0)
// "/t"表示退格键,为了让输出对齐
System.out.print("N\t");
// 输出10的j-1次方*N
else
System.out.print((int) Math.pow(10, j - 1) + "*N\t");
}
// 当i!=0时输出计算内容
else {
// 输出10的j-1次方*i
System.out.print((int) Math.pow(10, j - 1) * i + "\t");
}
}
System.out.println();// 换行输出
}
}
}
/**
*
* @param from start number
* @param to end number
*/
public void zhengchu(int from,int to)//here is 100 to 200
{
//first it can't be divided by 2, that means it is a odd number(奇数),so:
if(from%2!=0)
{
for(int i=from;i<=to;i+=2)//可以减少一半的比较次数
{
if(i%5!=0)
System.out.print(i+",");
}
}
else
{
for(int i=from+1;i<=to;i+=2)
{
if(i%5!=0)
System.out.print(i+",");
}
}
}