Skip to content

Instantly share code, notes, and snippets.

@archigoodvin07
Created October 3, 2021 18:40
Show Gist options
  • Save archigoodvin07/50b52281d132370740a5934258e401ec to your computer and use it in GitHub Desktop.
Save archigoodvin07/50b52281d132370740a5934258e401ec to your computer and use it in GitHub Desktop.
// "Triangle" Task
class Figure {
public static void main(String[] args) {
for (int i=0; i<3;i++) {
System.out.println();
for(int j=0;j<3;j++){
if(j<=i) {
System.out.print("*");
}
}
}
System.out.println();
for (int i=0; i<3;i++) {
System.out.println();
for(int j=0;j<3;j++){
if(i<=j) {
System.out.print("*");
} else {
System.out.print(" ");
}
}
}
System.out.println();
for (int i=0; i<3;i++) {
System.out.println();
for(int j=0;j<3;j++){
if(i+j>=2) {
System.out.print("*");
} else {
System.out.print(" ");
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment