解题思路:
注意事项:
参考代码:
import java.util.Scanner;
public class Main1127 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int x = sc.nextInt();
System.out.print("" + x + '*' + x + '*' + x + '=' + (int) Math.pow(x, 3) + '=');
for (int i = 0; i < 2 * x; i += 2) {
if (i == 2 * x - 2) {
System.out.print("" + ((int) Math.pow(x, 2) - x + 1 + i));
} else {
System.out.print("" + ((int) Math.pow(x, 2) - x + 1 + i) + '+');
}
}
}
}
0.0分
0 人评分
点我有惊喜!你懂得!浏览:1074 |
汽水瓶 (C语言代码)浏览:705 |
母牛的故事 (C语言代码)浏览:716 |
A+B for Input-Output Practice (III) (C语言代码)浏览:569 |
A+B for Input-Output Practice (C语言代码)浏览:468 |
矩阵乘方 (C语言代码)浏览:1031 |
循环入门练习6 (C语言代码)浏览:970 |
剪刀石头布 (C++代码)浏览:1713 |
整数平均值 (C语言代码)浏览:787 |
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:450 |