Write a program in C# Sharp to display the pattern like pyramid using an asterisk and each row contain an odd number of an asterisks
- برمجة سي شارب
- برمجة
- 2021-05-17
- MarwaMohammed
الأجوبة
using System;
public class Exercise20
{
public static void Main()
{
int i,j,n;
Console.Write("\n\n");
Console.Write("Display the pattern like pyramid containing odd number of asterisks:\n");
Console.Write("----------------------------------------------------------------------");
Console.Write("\n\n");
Console.Write("Input number of rows for this pattern :");
n= Convert.ToInt32(Console.ReadLine());
for(i=0;i<n;i++)
{
for(j=1;j<=n-i;j++)
Console.Write(" ");
for(j=1;j<=2*i-1;j++)
Console.Write("*");
Console.Write("\n");
}
}
}
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال