Previous Next
0 / 15
Module DEMO-33-68DEMO-OOP-33

Digit Counter Method

DEMO-OOP-33 โ€ข Object Oriented Programming

Browser-only practice

Problem Statement

Read a positive integer, implement countDigits, and print how many digits it has.

Input Format

Input is given as whitespace-separated tokens in this order:

  1. positive integer

Output Format

Print the exact report in this order:

  1. Digits

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
7
Digits: 1
Input: positive integer = 7.
Key calculation(s): count = 0 | value = 7 | "Digits: " + result = "Digits: 1".
Output:
Digits: 1
Sample #2
Public sample
1234
Digits: 4
Input: positive integer = 1234.
Key calculation(s): count = 0 | value = 1234 | "Digits: " + result = "Digits: 4".
Output:
Digits: 4

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings