Advertisement
RazorBlade57

Average

Nov 30th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.49 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class DigitCount {
  4.  
  5.  
  6.     public static void main(String[] args) {
  7.         Scanner keyboard = new Scanner(System.in);
  8.        
  9.         System.out.println("Please enter an integer ::");
  10.        
  11.  
  12.          int a = keyboard.nextInt();
  13.        
  14.  
  15.         int count = 0;
  16.        
  17.         while (a > 0){
  18.             a = a / 10;
  19.            
  20.             count++;
  21.            
  22.             int sum = (count++) / count;
  23.            
  24.         }
  25.         System.out.println(sum);
  26.  
  27.     }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement