用java编写一个程序,计算1!+2!+3!+4!+5!
人气:426 ℃ 时间:2020-01-26 11:00:25
解答
public class TestArray{public static void main(String[] args){int m = 0;for(int i = 1;i < 6;i++){int n = 1;for(int j = 1;j < i+1;j++){n = n * j;}m = m + n;}System.out.println(m);}}运行结果:153
推荐
猜你喜欢
- Everything is kind of pink.is kind of
- 点A(2,-3)关于轴对称的点的坐标为----------,关于原点对称的坐标为
- 请问软弱,不坚强的词语是什么
- 两方坚持对立,互不相让的四字词语是
- 已知向量a、b、c 、d满足:a模等于1,b模等于根号2,b在 a上的投影为1/2 ,向量a-c与向量b-c垂直
- 一筐苹果连筐中60千克,卖掉五分之二后,连筐重30千克,问着筐苹果净重多少千克
- in much the same way
- 关于学习的古人诗句,名言