// A program demonstrating the use of array of objects and indexing import java.util.Scanner; class index { public static void main (String[] args) { Scanner scan = new Scanner(System.in); String[] digits = {"zero","one","two","three","four","five","six","seven","eight","nine"}; System.out.print ("Enter a number: "); int num = scan.nextInt(); int d = 1; int n = num; while (n>0) {n = n /10; d = d * 10;} d = d/10; while (num>0) { System.out.print(digits[num/d] + " "); num = num % d; d = d / 10; } } }