// accept numbers from 0.1 to 99.9 then count the number of tens, ones, and tenths
import java.io.*;
public class accept99_9 {
public static void main(String[] args)throws IOException {
BufferedReader abc=new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter a value: ");
String input=abc.readLine();
float v=Float.parseFloat(input);
float tens=v %100;
float ones=v %10;
float tenths=v %10;
System.out.println("Number of tens: "+tens);
System.out.println("Number of ones: "+ones);
System.out.println("Number of tenths: "+tenths);
System.exit(0);
}
}
How will i come up with an output like these?
example....
Enter a value: 12.3
Number of tens: 1
Number of ones: 2
Number of tenths: 3
thanks........