hc学习平台

 找回密码
 立即注册
搜索
热搜: 活动 交友 javakc
 › chen987 › 日志

计算从0到10的数字的平方和立方,并按如下格式打印出来  

2022-07-07 20:40:16 查看(40) 回复(0)

 number    square    cube

 0             0           0

 1             1           1

 2             4           8

 3             9           27

 4             16         64

 5             25         125

 6             36         216

 7             49         343

 8             64         512

 9             81         729

 10           100       1000

 

public class f0_10 {
    public static void main(String[] args) {
        System.out.println("number square  cubee");
        int x;
        int y;
        for (int i = 0; i < 11; i++) {
            System.out.print(i);
            System.out.print("       ");
            y=i;
            x=y*i;
            System.out.print(x);
            System.out.print("       ");
            x=y*y*i;
            System.out.print(x);
            System.out.println("       ");
        }
    }
}

评论 (0 个评论)

facelist

全部作者的其他最新日志



站点统计|举报|Archiver|手机版|小黑屋|Comsenz Inc.

GMT+8, , Processed in 0.195171 second(s), 9 queries .

Powered by javakc! X1.0

© 2004-2014 javakc

f1208.com 备案号:京ICP备14030918号-1

返回顶部