0
Write a Java program that reads an positive integer and count the number of digits the number (less than ten billion)??
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner n = new Scanner(System.in); System.out.println("input a intger less than ten billon"); long p = n.nextLong(); int count = 0; while (p != 0) { p /= 10; count++; } System.out.println("the number of sigits is " +count); // tell me is this true solution } }
1 Odpowiedź
0
It looks good to me