编写Java程序计算一下1~100的所有整数中出现多少次数字9(用while循环实
答案:2 悬赏:60 手机版
解决时间 2021-01-20 20:01
- 提问者网友:星軌
- 2021-01-20 15:52
编写Java程序计算一下1~100的所有整数中出现多少次数字9(用while循环实
最佳答案
- 五星知识达人网友:你可爱的野爹
- 2021-01-20 16:20
int i = 0;
int count = 0;
while (i < 100) {
if (String.valueOf(i).contains("9")) {
System.out.println(i);
count++;
}
i++;
}
System.out.println("整数中9出现的次数:" + count);
int count = 0;
while (i < 100) {
if (String.valueOf(i).contains("9")) {
System.out.println(i);
count++;
}
i++;
}
System.out.println("整数中9出现的次数:" + count);
全部回答
- 1楼网友:詩光轨車
- 2021-01-20 16:26
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯