Write a c# program to print alphabet triangle.
using System; public class PrintAlphabetTriangle { public static void Main(string[] args) { // Declare variables int row, col; char ch = 'A'; // Print the alphabet triangle for (row = 1; row <= 5; row++) { for (col = 5; col >= row; col--) { Console.Write(" "); } for (col = 1; col <= row; col++) { Console.Write(ch++); } ch--; Console.WriteLine(); } } }
Write a c# program to print alphabet triangle.
Reviewed by Bhaumik Patel
on
8:55 PM
Rating: