import java.util.Scanner;
public class demo1 {
public static void main(String[] args)
{
int i,n;
System.out.print("Input number of terms : ");
Scanner in = new Scanner(System.in);
n = in.nextInt();
for(i=1;i<=n;i++)
{
System.out.println("Number is : " +i+" and cube of " +i+" is : "+(i*i*i));
}
}
}Java
Program to display the cube of the numbers.

Written by
View ProfileNikhil Juneja
Passionate software developer and technical contributor at TutorialsLink.
