Answers for "c# pattern"

0

c# pattern

using System;

namespace numberpattern_techstudy
{
    class Program
    {
        static void Main(string[] args)
        {
            int i, j, k;
            for (i = 5; i >= 1; i--)
            {
                k = i;
                for (j = 1; j <= 5; j++)
                {
                    if (k <= 5)
                    {
                        Console.Write(k);
                    }
                    else
                    {
                        Console.Write(5);
                    }
                    k++;
                }
                Console.WriteLine();
            }
            Console.ReadLine();

        }
    }
}
Posted by: Guest on June-09-2021

Browse Popular Code Answers by Language