I get the error "Expected Expression" on line 45:9 at the else statement in the for else loop.
Any ideas? I've been working on this pset for around 7 hours but can't figure it out.
// Includes the cs50 and standard IO libraries
#include <cs50.h>
#include <stdio.h>
// Declares the variables "n", "i", "l, and "w" as integers
int n; // height
int i; // height difference (invalid)
int l; // length
int w; // width
// Declares the main function "main()"
int main(void) {
// Checks whether n is a number between 0 and 23 and asks for a new input if false
do
{
printf("Please input a positive number under 23: ");
n = GetInt();
// If the userinput is above 23, the height difference will be displayed
if(n > 23){
i = 23 - n;
printf("Height: %i", i);
}
// If the userinput is below 0, the height difference will be displayed
else if (n < 0) {
i = 0 + n;
printf("Height: %i\n", i);
}
}
// Keep running the do loop until either "n" is below zero, or "n" is above 23
while (n < 0 || n > 23);
// If the number is between 1 and 23, then print pyramids with a height according to "n"
for(l = 1; l <= n; l++)
{
for(w = 1; w <= n; w++)
{
printf("#");
}
else if {
printf(" ");
}
printf("\n");
}
while(n == 0)
{
printf(" ");
}
return 0;
}