Skip to content

Instantly share code, notes, and snippets.

@mokomokohitsuzi
Created October 29, 2016 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mokomokohitsuzi/a4c50c3d08a4e948255b232052822e66 to your computer and use it in GitHub Desktop.
Save mokomokohitsuzi/a4c50c3d08a4e948255b232052822e66 to your computer and use it in GitHub Desktop.
新・明解Java入門 演習4-5
import java.util.Scanner;
public class En4_5 {
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);
while (x >= 0) {
System.out.println(--x);// 表示前にxをデクリメントする。
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment