Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  ‍Counter
Language: JAVA
Code:
package  javalike.Example;

import  java.util.Scanner;

public  class  Count_Of_Digit_N {

    public  static  void  main(String[] args) {
        Scanner intput = new Scanner(System.in);
        long x, n, counter = 0, temp;
        System.out.println("Enter n:");

        n = intput.nextInt();
        while (n > 0) {
            x = n % 10;
            counter++;
            n = n / 10;
        }
        System.out.println("Counter of Digits is " + counter);
    }
}
Comments: