Practical : 5
Subject : .Net
Aim : Write C# code to display the asterisk pattern as shown below:
Source Code :
Subject : .Net
Aim : Write C# code to display the asterisk pattern as shown below:
*****
****
***
**
*
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace pr008
{
class pat1
{
static void
Main(string[] ar)
{
int
i, j, k;
Console.Write("Enter
number : ");
int
n = Convert.ToInt32(Console.ReadLine());
for
(i = 0; i < n; i++)
{
for(j=0;j<=i;j++)
{
Console.Write("
");
}
for(k=n;k>i;k--)
{
Console.Write("*");
}
Console.WriteLine();
}
Console.ReadKey();
}
}
}
Output :
0 comments:
Post a Comment