码迷,mamicode.com
首页 > 其他好文 > 详细

while循环输出如下语句: 2*5=10 4*10=40 6*15=90 …… ?*100=?

时间:2017-06-15 00:38:40      阅读:1044      评论:0      收藏:0      [点我收藏+]

标签:nbsp   next   print   blog   while循环   author   new   scan   循环   

import java.util.Scanner;

/**
 * @author 蓝色以太 while循环输出如下语句: 2*5=10 4*10=40 6*15=90 …… ?*100=?
 */
public class While {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入层高:");
        int num = sc.nextInt();
        int i = 1;
        while (i <= num) {
            System.out.println(i * 2 + "*" + i * 5 + "=" + (i * 2 * i * 5));
            i++;
        }

    }

}

 

while循环输出如下语句: 2*5=10 4*10=40 6*15=90 …… ?*100=?

标签:nbsp   next   print   blog   while循环   author   new   scan   循环   

原文地址:http://www.cnblogs.com/lanseyitai1224/p/7011507.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!