200字
2026-10-08 课堂任务与课后作业
2026-10-08
2026-10-08

程序运行网站:

https://www.jyshare.com/compile/10/

课堂任务\课后作业:

You are developing a number analysis tool and need to count how many digits an integer has. For example: 58392 has 5 digits.Write a Java program named DigitCount that completes the following tasks in the main method:

Step 1: Create an int variable num with the value 58392; Create an int variable original to store the original value of num; Create an int variable count with an initial value of 0.

Step 2: Use a while loop with the condition num > 0; Each iteration, increment count by 1; Divide num by 10 to remove the last digit.

Step 3: Output in the following format:

After completing the basic requirements, try:

a).Count the number of even digits in the number.

b).Find the largest digit in the number. (Optional Challenge)

Please write the code for each of these two requirements separately.

请提交代码截图至问卷星https://v.wjx.cn/vm/mWi08c4.aspx#

2026-10-08 课堂任务与课后作业
作者
Administrator
发表于
2026-10-08
License
CC BY-NC-SA 4.0