class whileCount {
public static void main (String args[]) {
char input = (char) -1;
int numToCount;
System.out.println("Masukkan satu angka antara 0 dan 10: ");
try {
input = (char) System.in.read();
}
catch (Exception e) {
System.out.println("Error : " + e.toString());
}
numToCount = Character.digit(input, 10);
if ((numToCount > 0) && (numToCount < 10)) {
int i = 1;
while (i <= numToCount) {
System.out.println(i);
i++;
}
}
else System.out.println("Angka tsb tidak berada diantara 0 dan 10");
}
}
Diposting oleh Unknown

0 komentar:

Visit the Site
MARVEL and SPIDER-MAN: TM & 2010 Marvel Characters, Inc. Motion Picture © 2010 Columbia Pictures Industries, Inc. All Rights Reserved. 2010 Sony Pictures Digital Inc. All rights reserved. Provided By Free Website Templates | Freethemes4all.com
Free Website templatesFree Flash TemplatesFree joomla templatesSEO Web Design AgencyMusic Videos OnlineFree Wordpress Themes Templatesfreethemes4all.comFree Blog TemplatesLast NewsFree CMS TemplatesFree CSS TemplatesSoccer Videos OnlineFree Wordpress ThemesFree Web Templates