Created
December 26, 2016 07:58
-
-
Save prashanth-g/8caaa5bdabed7b5d882335d5f76b3477 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| package javapractices; | |
| public class Stars { | |
| public static void main(String[] args) { | |
| int numberOfRows = 5; | |
| for (int numberOfTimes = 1; numberOfTimes <= numberOfRows ; numberOfTimes++) { | |
| for (int numberOfSpaces = 0; numberOfSpaces < numberOfRows - numberOfTimes; numberOfSpaces++) { | |
| System.out.print(" "); | |
| } | |
| for (int numberOfStars = 0; numberOfStars < 2 * numberOfTimes - 1; numberOfStars++) { | |
| System.out.print("*"); | |
| } | |
| System.out.print("\n"); | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
// this can work