Answer:
The following answer is written in C# programming language:
using System; //using directives
public class Program //define a class
{
public static void Main() //define main method
{
int n; //set an integer variable
String val; // set string variable
Console.Write("Enter an integer value - "); // print message
val=Console.ReadLine(); // read value from the user
n=Convert.ToInt32(val); // convert string input into integer
for(int i = 1; i <= n; i++) // set for loop
{
for (int j = 1; j <= i; j++) //set for loop
{
System.Console.Write(" * "); // print "*"
}
System.Console.WriteLine("");
}
}
}
Input:
Enter an integer value - 4
Output:
*
* *
* * *
* * * *
Step-by-step explanation:
Here, we define a class "program", then define void type main method.
Then, we set two-variable first is integer type "n" and second is string type "val".
Then, we print the message for the user and then get input from the user in "val".
Then, we convert the string variable into the integer.
Then, set the for loop which starts from 1 to n, again we the set for loop which starts from 1 to i.
Then, we print an asterisk "*" and after that break the line.