Note that there are some explanatory texts on larger screens.

plurals
  1. POC# - Suggestions of control statement needed
    primarykey
    data
    text
    <p>I'm a student and I got a homework i need some minor help with =)</p> <h3>Here is my task:</h3> <p>Write an application that prompts the user to enter the size of a square and display a square of asterisks with the sides equal with entered integer. Your application works for side’s size from 2 to 16. If the user enters a number less than 2 or greater then 16, your application should display a square of size 2 or 16, respectively, and an error message.</p> <h3>This is how far I've come:</h3> <pre><code> start: int x; string input; Console.Write("Enter a number between 2-16: "); input = Console.ReadLine(); x = Int32.Parse(input); Console.WriteLine("\n"); if (x &lt;= 16 &amp; x &gt;= 2) { control statement code code code } else { Console.WriteLine("You must enter a number between 2 and 16"); goto start; } </code></pre> <h3>I need help with...</h3> <p>... what control statment(if, for, while, do-while, case, boolean) to use inside the "if" control.</p> <p>My ideas are like... </p> <p>do I write a code that writes out the boxes for every type of number entered? That's a lot of code... </p> <p>..there must be a code containing some "variable++" that could do the task for me, but then what control statement suits the task best?</p> <p>But if I use a "variable++" how am I supposed to write the spaces in the output, because after all, it has to be a SQUARE?!?! =)</p> <p>I'd love some suggestions on what type of statements to use, or maybe just a hint, of course not the whole solution as I am a student!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload