# 005public class Do-While結構式 { //do {敘述} while (條件判斷); 1+2+...+10迴圈 ``` public static void main(String[] args) { // 1 + 2 + ... + 10 = ? int sum = 0; int i = 1; do { sum += i++; }while (i<=10); System.out.println("1 + 2 + ... + 10 = " + sum); } } ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up