This is simple program. The student get as there first lab assignment. Just writing here to help them and understand the programming logic.
using System;
namespace MyApp
{
class string_triangle_class
{
static void Main(string[] args)
{
Console.WriteLine("Enter a string:");
string str = Console.ReadLine();
for (int j = 0; j < str.Length; j++ )
{
for (int i = 0; i <= j; i++ )
Console.Write(str[i]);
Console.WriteLine("");
}
Console.ReadLine();
}
}
}
No comments:
Post a Comment