Write a C# program that takes a number as input and then displays a rectangle of 3 columns wide and 5 rows tall using that digit

  • برمجة سي شارب
  • برمجة

Write a C# program that takes a number as input and then displays a rectangle of 3 columns wide and 5 rows tall using that digit

Sample Output:

Enter a number: 5                                                                                             
555  
5 5 
5 5
5 5 
555

الأجوبة

using System;
public class Exercise13
{
    public static void Main()
    {
        int x;
         
        Console.Write("Enter a number: ");
        x=Convert.ToInt32(Console.ReadLine());
     
        Console.WriteLine("{0}{0}{0}",x);
        Console.WriteLine("{0} {0}",x);
        Console.WriteLine("{0} {0}",x);
        Console.WriteLine("{0} {0}",x);
        Console.WriteLine("{0}{0}{0}",x);
    }
}
هل كان المحتوى مفيد؟

تبحث عن مدرس اونلاين؟

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...