Introduction
This article explains how to print all the letters A-Z using a single A-Z. The simplest concept for printing these is to create a 6 X 6 matrix on the paper and draw stars (*) where you want.
For example to print A:
- Create one 6X6 matrix on paper and draw stars (*) to make an A.

- Now write the row numbers and column numbers on this:

- Now make your condition and decide where we want the stars (*) and where we want spaces.


- By using the above 2 conditions create a single condition as below:

- So to design "A" we need to write the code as follows:
- static void A()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (((Col == 1 || Col == 5) && Row != 0) || ((Row == 0 || Row == 3) && (Col > 1 && Col < 5)))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
In the same manner as for the letter A, the letters B - Z can be designed like this:
Code for all letters (A - Z):
Code for all letters (A - Z):
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace AtoZ
- {
- class Program
- {
- static int Row, Col;
- static void Main(string[] args)
- {
- char choice;
- Console.WriteLine("Please Enter Any one Alphabate Which you want to print");
- choice = char.Parse(Console.ReadLine());
- switch (choice)
- {
- case 'a':
- case 'A':
- A();
- break;
- case 'b':
- case 'B':
- B();
- break;
- case 'c':
- case 'C':
- C();
- break;
- case 'd':
- case 'D':
- D();
- break;
- case 'e':
- case 'E':
- E();
- break;
- case 'f':
- case 'F':
- F();
- break;
- case 'g':
- case 'G':
- G();
- break;
- case 'h':
- case 'H':
- H();
- break;
- case 'i':
- case 'I':
- I();
- break;
- case 'j':
- case 'J':
- J();
- break;
- case 'k':
- case 'K':
- K();
- break;
- case 'l':
- case 'L':
- L();
- break;
- case 'm':
- case 'M':
- M();
- break;
- case 'n':
- case 'N':
- N();
- break;
- case 'o':
- case 'O':
- O();
- break;
- case 'p':
- case 'P':
- P();
- break;
- case 'q':
- case 'Q':
- Q();
- break;
- case 'r':
- case 'R':
- R();
- break;
- case 's':
- case 'S':
- S();
- break;
- case 't':
- case 'T':
- T();
- break;
- case 'u':
- case 'U':
- U();
- break;
- case 'v':
- case 'V':
- V();
- break;
- case 'w':
- case 'W':
- W();
- break;
- case 'x':
- case 'X':
- X();
- break;
- case 'y':
- case 'Y':
- Y();
- break;
- case 'z':
- case 'Z':
- Z();
- break;
- }
- }
- static void A()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (((Col == 1 || Col == 5) && Row != 0) || ((Row == 0 || Row == 3) && (Col > 1 && Col < 5)))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void B()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (Col == 1 || ((Row == 0 || Row == 3 || Row == 6) && (Col < 5 && Col > 1)) || (Col == 5 && (Row != 0 && Row != 3 && Row != 6)))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void C()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if ((Col == 1 && (Row != 0 && Row != 6)) || ((Row == 0 || Row == 6) && (Col > 1 && Col < 5)) || (Col == 5 && (Row == 1 || Row == 5)))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void D()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (Col == 1 || ((Row == 0 || Row == 6) && (Col > 1 && Col < 5)) || (Col == 5 && Row != 0 && Row != 6))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void E()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (Col == 1 || ((Row == 0 || Row == 6) && (Col > 1 && Col < 6)) || (Row == 3 && Col > 1 && Col < 5))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void F()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (Col == 1 || (Row == 0 && Col > 1 && Col < 6) || (Row == 3 && Col > 1 && Col < 5))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void G()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if ((Col == 1 && Row != 0 && Row != 6) || ((Row == 0 || Row == 6) && Col > 1 && Col < 5) || (Row == 3 && Col > 2 && Col < 6) || (Col == 5 && Row != 0 && Row != 2 && Row != 6))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void H()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if ((Col == 1 || Col == 5) || (Row == 3 && Col > 1 && Col < 6))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void I()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (Col == 3 || (Row == 0 && Col > 0 && Col < 6) || (Row == 6 && Col > 0 && Col < 6))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void J()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if ((Col == 4 && Row != 6) || (Row == 0 && Col > 2 && Col < 6) || (Row == 6 && Col == 3) || (Row == 5 && Col == 2))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void K()
- {
- int i, j;
- j = 5;
- i = 0;
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (Col == 1 || ((Row == Col + 1) && Col != 0))
- {
- Console.Write("*");
- }
- else if (Row == i && Col == j)
- {
- Console.Write("*");
- i++;
- j--;
- }
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void L()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (Col == 1 || (Row == 6 && Col != 0 && Col < 6))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void M()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (Col == 1 || Col == 5 || (Row == 2 && (Col == 2 || Col == 4)) || (Row == 3 && Col == 3))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void N()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (Col == 1 || Col == 5 || (Row == Col && Col != 0 && Col != 6))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void O()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (((Col == 1 || Col == 5) && Row != 0 && Row != 6) || ((Row == 0 || Row == 6) && Col > 1 && Col < 5))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void P()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (Col == 1 || ((Row == 0 || Row == 3) && Col > 0 && Col < 5) || ((Col == 5 || Col == 1) && (Row == 1 || Row == 2)))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void Q()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if ((Col == 1 && Row != 0 && Row != 6) || (Row == 0 && Col > 1 && Col < 5) || (Col == 5 && Row != 0 && Row != 5) || (Row == 6 && Col > 1 && Col < 4) || (Col == Row - 1 && Row > 3))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void R()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (Col == 1 || ((Row == 0 || Row == 3) && Col > 1 && Col < 5) || (Col == 5 && Row != 0 && Row < 3) || (Col == Row - 1 && Row > 2))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void S()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (((Row == 0 || Row == 3 || Row == 6) && Col > 1 && Col < 5) || (Col == 1 && (Row == 1 || Row == 2 || Row == 6)) || (Col == 5 && (Row == 0 || Row == 4 || Row == 5)))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void T()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (Col == 3 || (Row == 0 && Col > 0 && Col < 6))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void U()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (((Col == 1 || Col == 5) && Row != 6) || (Row == 6 && Col > 1 && Col < 5))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void V()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (((Col == 1 || Col == 5) && Row < 5) || (Row == 6 && Col == 3) || (Row == 5 && (Col == 2 || Col == 4)))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void W()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (((Col == 1 || Col == 5) && Row < 6) || ((Row == 5 || Row == 4) && Col == 3) || (Row == 6 && (Col == 2 || Col == 4)))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void X()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (((Col == 1 || Col == 5) && (Row > 4 || Row < 2)) || Row == Col && Col > 0 && Col < 6 || (Col == 2 && Row == 4) || (Col == 4 && Row == 2))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void Y()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (((Col == 1 || Col == 5) && Row < 2) || Row == Col && Col > 0 && Col < 4 || (Col == 4 && Row == 2) || ((Col == 3) && Row > 3))
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- static void Z()
- {
- for (Row = 0; Row < 7; Row++)
- {
- for (Col = 0; Col < 7; Col++)
- {
- if (((Row == 0 || Row == 6) && Col >= 0 && Col <= 6)||Row+Col==6)
- Console.Write("*");
- else
- Console.Write(" ");
- }
- Console.WriteLine();
- }
- }
- }
- }

Sam HobbsPosted May 15, 2014, 5:07 PM
You could create a structure or class with a row and column for each instance. Then you can create an array of the objects for where to put the asterisk (stars). Then you can create an array of all the letters. By doing that, the code would be much smaller.