Created
October 29, 2016 12:52
-
-
Save mokomokohitsuzi/a4c50c3d08a4e948255b232052822e66 to your computer and use it in GitHub Desktop.
新・明解Java入門 演習4-5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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