python使用while循环输出100以内的偶数(请运用while循环结构输出1 100中所有的奇数)
2023-08-03 18:57:45    互联网


(资料图片)

导读

1、以下为参考代码:public class Example13 {    public static void main(String[] args) {        int x = 1;        int count = 0;        while (x <= 10) {            if (x % 2 != 0) {                count++;            }            x++;        }        System.out.println("奇数的个数有:" + count);    }}以下为控制台:。

本文到此分享完毕,希望对大家有所帮助。

免责声明:本文由用户上传,如有侵权请联系删除!

关键词:

下一篇: 菲律宾钩体病已致至少225人死亡
上一篇: 最后一页