Created
April 18, 2011 17:35
-
-
Save scottfrazer/925767 to your computer and use it in GitHub Desktop.
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
public class CS1_Frazer_X11_1 | |
{ | |
public static void main(String[] args) | |
{ | |
int x; //the number the user enters for how large the triangle will be. | |
int y; // the number that determines how many astericks in that row. | |
System.out.println("Hello, please enter a number from one to fifty."); | |
Scanner k = new Scanner(System.in); | |
x = k.nextInt(); | |
int asteriskCount = 0; | |
if (x > 50 || x < 1) | |
System.out.println("Error! Invalid entry! Program will now exit n00b."); | |
for(y=0; y < 2*x-1; y++) { | |
if ( y < x-1 ) | |
asteriskCount++ | |
for( i = 0; i < asteriskCount; i++) { | |
System.out.print(asteriskCount); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment