JAVA今日2021.8.7

JAVA do while

do while 格式

do{
    //代码语句
}while(布尔表达式)

do while01

package JAVASE.struct;

public class DoWhile01 {
    public static void main(String[] args) {
        int i = 0;
        int s = 0;
        do {
            s = s + i;
            i++;
        }while(i<=100);
        System.out.println(s);
    }
}

2021.8.7

posted @ 2021-08-07 21:34  Walf1234  阅读(29)  评论(0)    收藏  举报