You need to write a program that will draw Pascal's triangle. I tried to write - shows only a half triangle.

#include <stdio.h> #include <conio.h> int main() { int number; scanf("%d", &number); for (int i = 0; i <= number-1; i++) { for (int spacja = 0; spacja <= number; spacja++) { printf(" "); } for (int j = 1; j <= i*2+1; j++) { printf("%d",j); } printf("\n"); } _getch(); return 0; } 

    1 answer 1

     for (int j = 1; j <= i*2+1; j++) { printf("%d ",j); } for (int j = i*2+1; j >= 1; j--) { printf("%d ",j); } 

    You have odd lines missing.

    • Output should be different) - Władysław
    • 2
      @ Władysław "Output" suits me personally. If you need help, bother to write what output you need and what you get. If you do not understand something in the answer - ask questions. - Igor