1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
import java.util.Scanner; /** * UVA10101 */ public class UVA10101 { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int times = 1; while (sc.hasNext()) { System.out.printf("%4d.", times); long input = sc.nextLong(); if (input != 0) BanglaNumber(input); else System.out.printf(" 0"); System.out.printf("\r\n"); times++; } sc.close(); } public static void BanglaNumber(long input) { if (input >= 10000000) { BanglaNumber(input / 10000000); System.out.printf(" kuti"); BanglaNumber(input % 10000000); } else if (input >= 100000) { BanglaNumber(input / 100000); System.out.printf(" lakh"); BanglaNumber(input % 100000); } else if (input >= 1000) { BanglaNumber(input / 1000); System.out.printf(" hajar"); BanglaNumber(input % 1000); } else if (input >= 100) { BanglaNumber(input / 100); System.out.printf(" shata"); BanglaNumber(input % 100); } else if (input != 0) { System.out.printf(" %d", input); } } } |