1.13: Rectangle

OBJECTIVE

Write a C# program to ask the user for a number and then display a rectangle 3 columns wide and 5 rows tall using that digit. For example: 

Enter a digit: 3 
333 
3 3 
3 3 
3 3 
333 

RESOLUTION


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace My3Development
{
public class Rectangle
{
    public static void Main(String[] args)
    {
       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);
            
       Console.ReadKey();
        
        }
    }
 }

DEMO RESULT


         PREVIOUS                                             HOME                                                NEXT

0 comments :

Please Enter best of your Comments