Proposed exercise
Create a program that asks the user for a string and displays a right-aligned triangle:
____o
___ho
__cho
_acho
Nacho
Output
Solution
using System; public class Triangle { static void Main(string[] args) { Console.Write("Tell a string:"); string Entry = Console.ReadLine(); string content=""; int j=1; for (int i=Entry.Length; i<=0;i--) { for (int c=0; c<=Entry.Length;c--) { Console.Write("_"); content = Convert.ToString(Entry.Substring(i, j)); j++; Console.Write(content); } Console.WriteLine(); } } }