Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package countthedigits;
- //Imports
- import java.util.Scanner;
- /**
- *
- * @author LemoneFresh
- */
- public class Countthedigits {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- // TODO code application logic here
- //define Variables
- final int lowBound = 0,
- highBound = 999999999;
- int userNum = 0,
- count = 0;
- // create a Scanner object to accept keyboard input
- Scanner keyboard = new Scanner(System.in);
- System.out.printf("Please enter a number greater than 0.");
- userNum = keyboard.nextInt();
- System.out.println("Number of digits in the entered integer are :: "+count);
- }
- public static int returnNum(int userNum , int count){
- while(userNum!=0){
- userNum = userNum/10;
- count++;
- }
- return count;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement