In: Computer Science
code in C#
How to count by n:
In the Main method add the code that counts by 1, 2, 3, 4, and 5 – see output below Use a nested for loop to implement the series of numbers C# Syntax:
The C# syntax for variable declarations, and if, if-else, while, and for statements is identical to Java
C# console output:
Console.Write("{0,2} ", number); // in this context number is an integer variable writes a number right-aligned in a column of width 2 followed by a blank  Console.Write("*"); // prints a *  Console.WriteLine(); // advances to the next line
Output:
1
2 4
3 6 9
4 8 12 16
5 10 15 20 25
C# code:
using System;
class Program {
    static void Main() {
        //looping from 1 to
5
        for(int
i=1;i<=5;i++){
           
//looping from 1 to i
           
for(int j=1;j<=i;j++)
               
//printing i*j
               
Console.Write((i*j)+" ");
           
//printing newline
           
Console.WriteLine();
        }
    }
}
Screenshot:

Output:
