Output:
Click Here For Java Online Compiler
Solution:
*** Find Cubes UPTO *** Enter no. of terms: 6 Cube of 1 is : 1 Cube of 2 is : 8 Cube of 3 is : 27 Cube of 4 is : 64 Cube of 5 is : 125 Cube of 6 is : 216
Click Here For Java Online Compiler
Solution:
import java.util.Scanner; public class CubeUpto { public static void main(String[] args) { System.out.println("*** Find Cubes UPTO ***" + "\n"); System.out.print("Enter no. of terms: "); Scanner in = new Scanner(System.in); int numberOfTerms = in.nextInt(); for (int i = 1; i <= numberOfTerms; i++) { System.out.println("Cube of " + i + " is : " + i * i * i); } } }
comment 0 comments:
more_vertsentiment_satisfied Emoticon