发布时间:2019-07-29 16:17:06
编写java应用程序,使用Scanner对象输入一个整数x,并在控制台console输出x以内所有自然数
public class Count { public static void main(String[] args) throws IOException { Scanner scanner=new Scanner(System.in); Integer i=scanner.nextInt(); for (int j = 0; j <20 ; j++) { i=i+i; System.out.println("第"+j+"次累加:"+i); } }}
试试