이 프로그램을 완료하는 데 어려움이 있습니다. 나는 asterik을 생성하는 프로그램을 만들려고 노력하지만 삼각형으로 만듭니다.Java에서 초보자 - 출력 제어 - Asterix 생성
이것은 내가 이미 가지고있는 것입니다.
public class 12345 {
public static void main(String[] args) {
int n = 0;
int spaces = n;
int ast;
System.out.println("Please enter a number from 1 - 50 and I will draw a triangle with these *");
Scanner keyboard = new Scanner(System.in);
n = keyboard.nextInt();
for (int i = 0; i < n; i++) {
ast = 2 * i + 1;
for (int j = 1; j <= spaces + ast; j++) {
if (j <= spaces)
System.out.print(' ');
else
System.out.print('*');
}
System.out.println();
spaces--;
}
}
}
그것은 asteriks를 생성하지만, 어떻게 ... 그들은 삼각형을 곳을 계속 할 수있을 것입니다 그래서 그들은 그때 작은 그들이 가서 더 크게, 그리고 ...
감사 너 미리!
숫자로 시작하는 클래스 이름은 허용됩니까 ???? ????? – Shekhar
마름모 같은 구조를 만들고 싶습니까? – vikiiii
에서 시작하여 '직각 삼각형'을 만듭니다. – Azodious