I have written the following code myself:
Code:
#include <stdio.h>
int main()
{
int width;
int height;
printf("Please enter the width and height for your rectangle (separated by a comma, e.g. 3,4): \n");
scanf("%d,%d", &width, &height);
{
if (width > 80)
{
printf("Invalid value - %d is too wide.\n", width);
}
else if (width < 0)
{
printf("Invalid value: %d is a negative integer.\n", width);
}
else
return 0;
}
{
if (height > 80)
{
printf("Invalid value - %d is too high.\n", height);
}
else if (height < 0)
{
printf("Invalid value: %d is a negative integer\n", height);
}
else
return 0;
}
while (width == 0 || height == 0 )
break;
{
for (height > 0 && height <= 80; height == 0; --height)
{
for(width > 0 && width <= 80; width == 0; --width)
{
printf("*");
}
printf("\n");
}
while ((height * width) > 0 && (height * width) <= 6400)
{
int main();
}
}
}
However after I compile this code, the code/program asks for the input and does not return the output. In this case, the output is a rectangle (maximum dimensions 80x80 characters) composed of asterisks.
Any assistance/suggestions on debugging this program would be appreciated.