Showing posts with label Print Digits. Show all posts
Showing posts with label Print Digits. Show all posts

Wednesday, June 29, 2022

Print Digits

 Print Digits

Problem Statement

Given a natural number N, your task is to print all the digits of the number in words. The words have to separated by space and in lowercase english letters.

static void Print_Digits(int N){
//Enter your code here
String values[]={"zero","one","two","three","four","five","six","seven","eight","nine"};
String num=Integer.toString(N);
       for(int i=0;i<num.length();i++)
           {
           char index=num.charAt(i);
            System.out.print(values[Character.getNumericValue(index)]+" ");
} }

ads vert

Basic HTML Tables - Layout, HTML Tables, Attributes, Aside, Footer, Tr tag, Td tag, Th tag, Tbody

  Basic HTML Tables - Layout, HTML Tables, Attributes, Aside, Footer, Tr tag, Td tag, Th tag, Tbody < table >      < thead >    ...