Simple Loop Problem toward Print A B D H P
Problem Statement:
Write a program using beneficial to loop which prints the following output. (You have toward find a pattern toward print alphabetics in this order)
A B D H P
Solution:
static void Main(string[] args)
{
int i,j,ch=0,n;
Console.Write("A ");
beneficial to (i = 1; i <= 4; i++)
{
n = 1;
beneficial to (j = 1; j <= i; j++)
{
n = n * 2;
ch = 64 + n;
}
Console.Write((char)ch + " ");
}
Console.ReadLine();
}