Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How to make a hallow rectangle with asteriks in C#? What you need to do for this

ID: 3708954 • Letter: H

Question

How to make a hallow rectangle with asteriks in C#?

What you need to do for this exercise In the starter project, fill in the Nested_Loops_Hollow_Rectangles.RunExercise method, so that it will print out a hollow rectangle. The user should be prompted to enter the size of the sides of the rectangle. Within your nested loops, you should use a single if..else statement in order to figure what to print. This requirement is here to force you to use logical operators -feel free to get your program working however you can, then change it (after making a back-up copy!!) so it uses the single if.else before you hand it in An example transcript of what your program might look like follows. User input looks like this. Welcome to HollowRectanglePrinter! How many columns wide should the rectangle be? 6 How many rows tall should the rectangle be? 4 Here you go: k***xik kx***x

Explanation / Answer

using System.IO;
using System;

class Program
{
static void Main()
{
Console.WriteLine("Welcome to HollowRectanglePrinter!");
Console.WriteLine("How many columns wide should the rectangle be? ");
int c = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("How many rows tall should the rectangle be? ");
int r = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Here you go:");
for(int i=0;i<r;i++) {
for(int j=0;j<c;j++) {
if(i==0||i==r-1||j==0||j==c-1) {
Console.Write(" * ");   
} else {
Console.Write(" ");
}
  
}
Console.WriteLine();
}
}
}

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote