Last active
October 30, 2016 12:37
-
-
Save mokomokohitsuzi/23bdf7177e1bf1e0d3b26cb953ec7708 to your computer and use it in GitHub Desktop.
新・明解Java入門 演習4-6-1
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_6_1 { | |
public static void main(String[] args) { | |
Scanner stdIn = new Scanner(System.in); | |
System.out.print("何個*を表示しますか:"); | |
int n = stdIn.nextInt(); | |
int i = 0; | |
while (i < n) { | |
System.out.print('*'); | |
i++; | |
} | |
if (n > 0) { | |
System.out.println();//0より大きい場合は、改行文字を出力。 | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment