Can anybody help me to create following program in c#
* * * * *
* *
* *
* *
* * * * *
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Manish Kumar ChoudharyPosted Feb 18, 2015, 6:16 AM
Following are the program just input 5 5 it
will print the output as you want.
using System;
namespace DotNetMirror
{
class PrintRectangleStars
{
static void Main()
{
Console.WriteLine("Program to Print Rectangle *'s");
int width = 0, height = 0;
Console.Write("Enter Height :");
height = int.Parse(Console.ReadLine());
Console.Write("Enter Width :");
width = int.Parse(Console.ReadLine());
for (int i = 1; i <= height; i++)
{
for (int j = 1; j <= width; j++)
{
if ((i == 1 || i == height) || (j == 1 || j == width))
Console.Write("*"); //prints at border place
else
Console.Write(" "); //prints inside other than border
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}