My windows works slowly, so I installed a standalone Ubuntu 32-bit.
here's my code:
/**
* mario.c
*
* Kiril Reznikovsky
* [email protected]
* Builds a half-piramid according to given height
*/
#include <stdio.h>
#include <ctype.h>
int main()
{
int height;
printf("Please insert zero or a positive integer no greater than 23: ");
scanf("%d",&height);
while((isdigit(height) == 0) || height > 23 || height < 0)
{
printf("Please insert zero or a positive integer no greater than 23: ");
scanf("%d",&height);
}
printf("\n");
for(int pLvl = 0;pLvl < height;pLvl++)
{
for(int blanks = pLvl;blanks < 7;blanks++)
{
printf(" ");
}
for(int bricks = 0;bricks < pLvl + 2;bricks++)
{
printf("#");
}
printf("\n");
}
return (0);
}
I don't understand why isdigit is not doing what it is supposed to do.