#include <cs50.h>
#include <stdio.h>
void pyramid(int height);
int main(void){
printf("Height: ");
int height = get_int();
if (height < 0 || height > 23) {
printf("Height: ");
height = get_int();
} else if (height==0){
printf("");
} else {
printf("\n");
pyramid(height);
}
}
void pyramid(int height){
int n=1;
for(int i=0; i<height; i++){
for(int j=0; j<height-n; j++){
printf(" ");
}
for(int k=0; k<n; k++){
printf("#");
}
printf(" ");
for(int k=0; k<n; k++){
printf("#");
}
printf("\n");
n++;
}
}
I do not have spaces on the right side of the pyramid as far as I know. Here is the check50 link. Why is it telling me that the output is incorrect?