Computer Science, asked by preeti123khusi, 1 year ago

write a program in java to input 10 numbers. Use a function to find and print the cube of each number

Answers

Answered by Deepak1011dp
8
imort 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);

    }
}
Similar questions