C# Program to Print Alphabet Triangle - c# - c# tutorial - c# net



Related Tags: kurs c# , c# programmieren , tutorial c# visual studio , learn programming with c# , c# kurs online , the best way to learn c# , c# tutorial for complete beginners from scratch , tuto c# , manual c#

How to write Program Print Alphabet Triangle in C# ?

  • There are different triangles that can be printed.
    • Triangles can be generated by alphabets or numbers.
    • learn c# tutorials - triangle numbers - triangel alphabets programs in csharp - c# programs

      learn c# tutorial - triangle numbers - triangel alphabets programs in csharp - c# programs - c# Example

    • In this C# program, we are going to print alphabet triangles.

Example to print Alphabet Triangle

Example1:

using System;  
public class PrintExample  
 {  
 public static void Main(string[] args)  
     {  
char ch='A';      
int i, j, k, m;      
for(i=1; i<=5; i++)      
       {      
        for(j=5; j>=i; j--)      
         Console.Write(" ");      
        for(k=1;k<=i;k++)      
         Console.Write(ch++);      
        ch--;      
        for(m=1;m<i;m++)      
         Console.Write(--ch);      
        Console.Write("\n");      
        ch='A';      
       }      
  }  
} 
click below button to copy the code. By - c# tutorial - team

C# examples - Output :

     A
    ABA
   ABCBA
  ABCDCBA
 ABCDEDCBA

Example 2:

#include<stdio.h>
#include<conio.h>

void main()
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=1;j<=i;j++)
{
printf("%c",'A'-1 + i);
}
printf("\n");
}
getch();
}
click below button to copy the code. By - c# tutorial - team
Related Tags: kurs c# , c# programmieren , tutorial c# visual studio , learn programming with c# , c# kurs online , the best way to learn c# , c# tutorial for complete beginners from scratch , tuto c# , manual c#

C# examples - Output :

A
BB
CCC
DDDD
EEEEE

Example 3:

#include<stdio.h>
#include<conio.h>

void main()
{
int i, j;
for(i=1;i<=5;i++)
{
for(j=5;j>=i;j--)
{
printf("%c",'A'-1 + i);
}
printf("\n");
}
getch();
}
click below button to copy the code. By - c# tutorial - team

C# examples - Output :

AAAAA
BBBB
CCC
DD
E


Related Searches to C# Program to Print Alphabet Triangle