Created
March 18, 2020 02:37
-
-
Save ufebri/48c3ce5f45881cf45f481fb94ca6777a 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 PiramidCounter { | |
public static void main(String[] args) { | |
showPiramidCounter(5); | |
} | |
private static void showPiramidCounter(int n) { | |
int counter = 1; | |
for (int i = 1; i <= n; ++i) { | |
for (int o = 1; o <= i; ++o) { | |
System.out.print(counter + " "); | |
counter++; | |
} | |
System.out.println(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment