Write a C# Sharp program that takes a number and a width also a number, as input and then displays a triangle of that width, using that number
- برمجة سي شارب
- برمجة
- 2021-05-17
- MarwaMohammed
الأجوبة
using System;
public class Exercise2
{
public static void Main()
{
Console.Write("Input a number: ");
int num = Convert.ToInt32( Console.ReadLine() );
Console.Write("Input the desired width: ");
int width = Convert.ToInt32( Console.ReadLine() );
int height = width;
for (int row=0; row < height; row++)
{
for (int column=0; column < width; column++)
{
Console.Write( num );
}
Console.WriteLine();
width--;
}
}
}
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال