Write a program in java to input 10 numbers.
Answers
Answered by
2
The given code accepts 10 numbers from the user and stored into array. Then it find the cubes of the input numbers and display it on console.
import java.util.*; class CubeOfNumbers{ public static void findCube(int num[]){ for(int i=0;i<num.length;i++){ System.out.println("Cube of "+num[i]+" is: "+(num[i]*num[i]*num[i])); } } public static void main(String args[]){ Scanner input=new Scanner(System.in); int array[]=new int[10]; for(int i=0;i<array.length;i++){ array[i]=input.nextInt(); } findCube(array); } }
Follow me ✌️✌️✌️✌️
Similar questions
Math,
6 months ago
Math,
6 months ago
India Languages,
11 months ago
Biology,
1 year ago
Biology,
1 year ago