write a short program to input a digit and print it in words in java
write a short program to input a digit and print it in words in java
package com.company; import java.util.Scanner; public class StringProg2 { static void printValue(int digit) { switch (digit) { case '0': System.out.print("Zero "); break; case '1': System.out.print("One "); break; case '2': System.out.print("Two "); break; case '3': System.out.print("Three "); break; case '4': System.out.print("Four "); break; case '5': System.out.print("Five "); break; case '6': System.out.print("Six "); break; case '7': System.out.print("Seven "); break; case '8': System.out.print("Eight "); break; case '9': System.out.print("Nine "); break; } } static void printWord(String N) { int i, length = N.length(); for (i = 0; i < length; i++) { printValue(N.charAt(i)); } } public static void main(String[] args) { Scanner sc = new Scanner(System.in); System.out.println("Input String : "); String str = sc.nextLine(); printWord(str); } }
Thanks for reading this blog. Hope you get satisfied with the blog and definitely this blog must have valued your time and effort of reading.
Take a time to connect our other digital creations such as Instagram , Facebook and Youtube.
Β Social MediaΒ LinksΒ ofΒ Tech DCodeΒ :
YouTube :Β https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
Instagram :Β https://www.instagram.com/thetechdcode/
Facebook Page :Β https://www.facebook.com/thetechdcode
Twitter :Β https://twitter.com/thetechdcode
Telegram Channel :Β https://t.me/thetechdcode
Tech DCode Linktree :Β https://linktr.ee/thetechdcode
My Personal Handles :Β https://linktr.ee/virtualshivamin
Β Social Media LinksΒ ofΒ SHIVAM SINGHΒ (OWNER) :
Instagram :Β https://www.instagram.com/virtualshivamin/
Facebook Page :Β https://www.facebook.com/virtualshivamin/
Twitter :Β https://twitter.com/virtualshivamin/
Personal Linktree :Β https://linktr.ee/virtualshivaminΒ