Tuesday, 29 October 2019

For...For...Loop(Nested Loop) Condition and Find * pattern_24

For...For...Loop(Nested Loop) Condition and Find * pattern_24
            ///5        5
            ///45      45
            ///345    345
            ///2345  2345
            ///12345 2345
using System;
class Class1
    {
        public static void Main()
        {
       int i, j, n;
            Console.Write("Enter number of lines.....>");
            n = Convert.ToInt32(Console.ReadLine());
            for (i = n; i >= 1; i--)
            {
                for (j = i; j <= n; j++)
                    Console.Write(j);
                for (j = 1; j <= 2 * i - 3; j++)
                    Console.Write(" ");
                if (i == 1)
                {
                    j = i + 1;
                }
                else
                {
                    j = i;
                }
                for (; j <= n; j++)
                    Console.Write(j);
                Console.ReadLine();
            }
        }
    }
https://www.youtube.com/channel/UCKLRUr6U5OFeu7FLOpQ-FSw/videos

0 comments

Post a Comment