Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
新・明解Java入門 演習4-11
import java.util.Scanner;
public class En4_11 {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
System.out.println("カウントダウンします。");
int x;
do {
System.out.print("正の整数値:");
x = stdIn.nextInt();
} while (x <= 0);
// iにxを代入。iが0以上の場合、iを-1して繰り返す。
for (int i = x; i >= 0; i--) {
System.out.println(i);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment