hey guys i need help here i can't create the exact same code as my friend here is the code
#include <stdio.h>
int main() {
int height;
int a;
int pager;
int spacel;
do {
printf("Height: ");
scanf_s("%d", &height);
} while (!(height > 0) || !(height < 24));
for (a = 0; a < height; a++) {
for (spacel = height - a; spacel > 0; spacel--) {
printf(" ");
}
for (pager = 0; pager < (a + 1); pager++) {
printf("#");
}
printf(" ");
for (pager = 0; pager < (a + 1); pager++) {
printf("#");
}
printf("\n");
}
return 0;
}
and this is my version
Main issues:
1. C . It's 2018, why C unless absolutely forced....
2. Your bounds check of "a" doesn't do what you think it does. & is a binary operation. && is "and".
3. You put a semicolon at line 19, so the for loop basically does nothing.