zoukankan      html  css  js  c++  java
  • 编写一个小游戏:把从起始数到100之内的所有的整数中的是7的倍数的和含有7的数字数都剔除掉,打印其它的数;

    package arithmetic;
    
    import java.util.Scanner;
    
    import org.junit.Test;
    
    public class Test03 {
    	/**
    	 * 编写一个小游戏:把从起始数到100之内的所有的整数中的
    	 * 是7的倍数的和含有7的数字数都剔除掉,打印其它的数;
    	 */
    	@Test
    	public static void main(String[] args) {
    		Scanner s = new Scanner(System.in);
    		System.out.println("请输入一个数字:");
    		int j = s.nextInt();
    		for (int i = j; i <= 100; i++) {
    			if((i%7!=0) && (i%10!=7)&&(i/10!=7))
    				System.out.print(i+" ");
    		}
    	}
    }
    
  • 相关阅读:
    2-5
    2-4 及 1、2两章 学习心得 和问题
    2-3
    4-8
    4-6
    4-5
    4-4
    4-3
    4-2
    4-1
  • 原文地址:https://www.cnblogs.com/TaoLeonis/p/6582230.html
Copyright © 2011-2022 走看看