Skip to content

Instantly share code, notes, and snippets.

@keehyun2
Created January 18, 2018 10:04
Show Gist options
  • Select an option

  • Save keehyun2/b0836a74fa134760226c375258657f59 to your computer and use it in GitHub Desktop.

Select an option

Save keehyun2/b0836a74fa134760226c375258657f59 to your computer and use it in GitHub Desktop.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main{
public static void main(String args[]) throws NumberFormatException, IOException{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
final int N = Integer.parseInt(br.readLine());
StringBuilder sb = new StringBuilder();
for (int i = 0; i < N; i++) {
for (int j = 0; j < N ; j++) {
if (j < i) {
sb.append(" ");
}else {
sb.append("*");
}
}
sb.append("\n");
}
System.out.println(sb);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment