Question

Computing 1 daily 12

Computing 1 daily 12
Computing 1 daily 12
Computing 1 daily 12
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Here is the code for you:

#include <stdio.h>
#include <stdlib.h>
int readValueInRange(int min, int max)
{
char string[10];
int num;
scanf("%s", string);
num = atoi(string);
while(num < 1 || num > 79)
{
printf("I'm sorry, that number is unrecognized or out of range, try [%i-%i]: ", min, max);
scanf("%s", string);
num = atoi(string);
}
return num;
}
void draw_box(int rows, int cols)
{
for(int i = 0; i < rows; i++)
{
for(int j = 0; j < cols; j++)
printf("%%");
printf("\n");
}
}

int main()
{
printf("Please enter the number of percents you want in your line: ");
int cols = readValueInRange(1, 79);
printf("Please enter the number of lines you want in your box: ");
int rows = readValueInRange(1, 23);
draw_box(rows, cols);
}

And the output screenshot is:

If you need any refinements, just get back to me.

Add a comment
Know the answer?
Add Answer to:
Computing 1 daily 12
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT