Ejercicio
Triángulo lado derecho
Objetivo
Cree un programa en C# que solicite al usuario una cadena y muestre un triángulo alineado a la derecha:
____n
___an
__uan
Juan
Código
using System;
public class Exercise88
{
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();
}
}
}