import java.util.*;
class Print_Numeric { public static void main(String args[]) {a int num; int a = 1, rev = 0, digit = 0; Scanner sc = new Scanner(System.in); num = sc.nextInt(); if (num % 10 == 0) { a = num % 10; } while (num > 0) { digit = num % 10; rev = rev * 10 + digit; num = num / 10; } while (rev > 0) { digit = rev % 10; switch (digit) { case 0: System.out.println("\n Zero"); break; case 1: System.out.println("\n One"); break; case 2: System.out.println("\n Two"); break; case 3: System.out.println("\n Three"); break; case 4: System.out.println("\n Four"); break; case 5: System.out.println("\n Five"); break; case 6: System.out.println("\n Six"); break; case 7: System.out.println("\n Seven"); break; case 8: System.out.println("\n Eight"); break; case 9: System.out.println("\n Nine"); break; default: System.out.println(" Enter a Valid Number.. "); } rev = rev / 10; } if (a == 0) { System.out.println("\n Zero"); } } } |
OUTPUT:
345 Three Four Five |
No comments:
Post a Comment