JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/*
Created by Nuha in Q&A Post
- https://www.sololearn.com/Discuss/2201922/
Fixed by AJ Anant
- https://code.sololearn.com/cqbA5rV4czJ1/
Revised by David Carroll (This Code)
- https://code.sololearn.com/c2N8EqX5aPOQ/
BTW: I can't believe that Java still doesn't have string interpolation.🤦♂️
*/
import java.util.Scanner;
import static java.lang.System.out;
public class Exercise {
public static void main(String[] args) {
out.print("input number of terms");
var max = new Scanner(System.in).nextInt();
out.println(" = " + max + "\n");
var msg = "term %1$d: cube of %1$d is %2$s";
for(int term = 1; term <= max; term++) {
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run