Program to print the Alphabets of a Given Word using * pattern

15 Jun, 2021
Given a word str, the task is to print the alphabets of this word using * pattern.Examples:  
Input: GFG
Output:
   ******
  *      
 *       
 *       
 *   ****
 *   *  *
  *  *  *
   ***  *

 *******
 **     
 **     
 ****** 
 **     
 **     
 **     
        

   ******
  *      
 *       
 *       
 *   ****
 *   *  *
  *  *  *
   ***  *
Approach: A simple implementation is to form the pattern for each letter A-Z and call them as functions.Below is the implementation of the above approach:  
C++
C
Java
C#
// C++ Program to print the Alphabets// of a Given Word using * pattern#include <iostream>using namespace std;char ch; // Function to print the letter Avoid a(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";        for (int a = 0; a < 8; a++) {            if (i == 0 && (a == 0 || a == 7))                cout << " ";            else if (a < 2 || a > 5) {                cout << ch;            }            else if (i < 2 || (i > 3 && i < 5)) {                cout << ch;            }             else                cout << " ";        }        cout << endl;    }} // Function to print the letter Bvoid b(void){    cout << endl;    for (int i = 0; i < 9; i++) {        cout << ch << ch;         for (int r = 0; r < 6; r++) {            if (i == 0 && r < 5)                cout << ch;            else if (i == 1)                cout << ch;            else if (i < 4 && i > 0                     && r > 3) {                cout << ch;            }             else if (i == 4 && r < 5) {                cout << ch;            }            else if (i > 4 && i < 7                     && r > 3) {                cout << ch;            }            else if (i == 7) {                cout << ch;            }            else if (i == 8 && r < 5) {                cout << ch;            }             else                cout << " ";        }        cout << endl;    }} // Function to print the letter Cvoid c(void){    cout << endl;    for (int i = 0; i < 8; i++) {         cout << " ";        for (int o = 0; o < 8; o++) {            if (i == 0 && (o <= 1))                cout << " ";            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o > 1)))                cout << " ";            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o > 1)))                cout << " ";            else if ((i == 3 || i == 4                      || i == 5)                     && (o > 0))                cout << " ";            else if (i == 6                     && (o == 0 || o == 8 + 5 - i                         || (o > 1)))                cout << " ";            else if (i == 7                     && (o <= 1))                cout << " ";            else {                cout << ch;            }        }        cout << endl;    }} // Function to print the letter Dvoid d(void){    cout << endl;    for (int i = 0; i < 8; i++) {        {            cout << " "<< ch;        }         for (int o = 0; o < 8; o++) {            if (i == 0 && (o >= 6 - i))                cout << " ";            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o < 6)))                cout << " ";            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o < 6)))                cout << " ";            else if ((i == 3 || i == 4                      || i == 5)                     && (o < 7))                cout << " ";            else if (i == 6                     && (o == 0 || o == 8 + 5 - i                         || (o < 6)))                cout << " ";            else if (i == 7                     && (o >= 6 - i + 7))                cout << " ";            else {                cout << ch;            }        }        cout << endl;    }} // Function to print the letter Evoid e(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";        for (int j = 0; j < 7; j++) {            if (i == 0) {                cout << ch;            }            else if (i > 0 && i < 3                     && j < 2) {                cout << ch;            }            else if (i == 3 && j < 6) {                cout << ch;            }            else if (i > 3 && i < 6                     && j < 2) {                cout << ch;            }            else if (i == 6) {                cout << ch;            }             else                cout << " ";        }        cout << endl;    }} // Function to print the letter Fvoid f(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";        for (int j = 0; j < 7; j++) {            if (i == 0) {                cout << ch;            }            else if (i > 0 && i < 3                     && j < 2) {                cout << ch;            }            else if (i == 3 && j < 6) {                cout << ch;            }            else if (i > 3 && i < 7                     && j < 2) {                cout << ch;            }             else                cout << " ";        }        cout << endl;    }} // Function to print the letter Gvoid g(void){    cout << endl;    for (int i = 0; i < 8; i++) {         cout << " ";        for (int o = 0; o < 8; o++) {            if (i == 4 && o > 3                || (o == 4 || o == 7)                       && i > 4) {                cout << ch;            }             else if (i == 0 && (o <= 1))                cout << " ";            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o > 1)))                cout << " ";            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o > 1)))                cout << " ";            else if ((i == 3 || i == 4                      || i == 5)                     && (o > 0))                cout << " ";            else if (i == 6                     && (o == 0 || (o > 1)))                cout << " ";            else if (i == 7                     && (o <= 1 || o == 5                         || o == 6))                cout << " ";            else {                cout << ch;            }        }        cout << endl;    }} // Function to print the letter Hvoid h(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";        for (int h = 0; h < 8; h++) {            if (h < 2 || h > 5) {                cout << ch;            }            else if (i > 2 && i < 5) {                cout << ch;            }             else                cout << " ";        }        cout << endl;    }} // Function to print the letter Ivoid i(void){    cout << endl;    for (int i = 0; i < 8; i++) {         cout << " ";         for (int t = 0; t < 8; t++) {             if ((i < 1 || i > 6)                && t < 8) {                cout << ch;            }             else if (i > 0 && t < 3)                cout << " ";            else if (i > 0 && t > 2                     && t < 5) {                cout << ch;            }            else if (i > 0 && t > 4)                cout << " ";            else {            }        }        cout << endl;    }} // Function to print the letter Jvoid j(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";         for (int h = 0; h < 8; h++) {            if (i < 1) {                cout << ch;            }            else if (i == 5 && h < 1) {                cout << ch;            }            else if (i < 7 && h > 5) {                cout << ch;            }            else if (i == 7                     && (h == 0 || h == 7))                cout << " ";            else if (i > 5) {                cout << ch;            }            else                cout << " ";        }        cout << endl;    }} // Function to print the letter Kvoid k(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";         for (int k1 = 0; k1 < 7; k1++) {            if (k1 < 2) {                cout << ch;            }            else if ((k1 >= 5 - i)                     && (k1 <= 6 - i)) {                cout << ch;            }             else if (i >= 4) {                if (k1 == i - 2 || k1 == i - 1) {                    cout << ch;                }                else                    cout << " ";            }            else                cout << " ";        }        cout << endl;    }} // Function to print the letter Lvoid l(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";         {            cout << ch << ch;        }        if (i == 6) {            {                cout << ch << ch;            }            {                cout << ch << ch;            }            cout << ch << ch;        }        if (i == 7) {            {                cout << ch << ch;            }            {                cout << ch << ch;            }            cout << ch << ch;        }        cout << endl;    }} // Function to print the letter Mvoid m(void){    cout << endl;     for (int i = 0; i < 8; i++) {        cout << " ";        for (int j = 0; j < 8; j++) {            if (j == 0 || j == 7) {                cout << ch;            }            else if (i < 4                     && (j == 7 - i || j == i)) {                cout << ch;            }            else                cout << " ";        }        cout << endl;    }} // Function to print the letter Nvoid n(void){    cout << endl;     for (int i = 0; i < 8; i++) {        cout << " ";        for (int n = 0; n < 8; n++) {            if (n < 2 || n > 5) {                cout << ch;            }            else if (i == n - 1                     || i == n + 1 || i == n) {                cout << ch;            }            else                cout << " ";        }        cout << endl;    }} // Function to print the letter Ovoid o(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";        for (int o = 0; o < 8; o++) {            if (i == 0 && (o <= 1 || o >= 6 - i))                cout << " ";            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o < 6 && o > 1)))                cout << " ";            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o < 6 && o > 1)))                cout << " ";            else if ((i == 3 || i == 4 || i == 5)                     && (o > 0 && o < 7))                cout << " ";            else if (i == 6                     && (o == 0 || o == 8 + 5 - i                         || (o < 6 && o > 1)))                cout << " ";            else if (i == 7                     && (o <= 1 || o >= 6 - i + 7))                cout << " ";            else {                cout << ch;            }        }        cout << endl;    }} // Function to print the letter Pvoid p(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";        {            cout << ch << ch;        }         for (int r = 0; r < 6; r++) {            if (i == 0 && r < 5)                cout << ch;            else if (i == 1)                cout << ch;            else if (i < 4 && i > 0 && r > 3) {                cout << ch;            }             else if (i == 4 && r < 5) {                cout << ch;            }            else                cout << " ";        }        cout << endl;    }} // Function to print the letter Qvoid q(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";        for (int o = 0; o < 8; o++) {            if (o == i)                cout << ch;             else if (i == 0                     && (o <= 1 || o >= 6 - i))                cout << " ";            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o < 6 && o > 1)))                cout << " ";            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o < 6 && o > 1)))                cout << " ";            else if ((i == 3 || i == 4 || i == 5)                     && (o > 0 && o < 7))                cout << " ";            else if (i == 6                     && (o == 0 || o == 8 + 5 - i                         || (o < 6 && o > 1)))                cout << " ";            else if (i == 7                     && (o <= 1 || o >= 6 - i + 7))                cout << " ";            else {                cout << ch;            }        }        cout << endl;    }} // Function to print the letter Rvoid r(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";        {            cout << ch << ch;        }         for (int r = 0; r < 6; r++) {            if (i == 0 && r < 5)                cout << ch;            else if (i == 1)                cout << ch;            else if (i < 4 && i > 0                     && r > 3) {                cout << ch;            }             else if (i >= 4) {                if (i == 4                    && (r == 3 || r == 4)) {                    cout << ch;                }                 else if (r == i - 2                         || r == i - 3) {                    cout << ch;                }                else                    cout << " ";            }            else                cout << " ";        }        cout << endl;    }} // Function to print the letter Svoid s(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";        for (int j = 0; j < 7; j++) {            if (i == 0 && j > 0) {                cout << ch;            }            else if (i > 0 && i < 3                     && j < 2) {                cout << ch;            }            else if (i == 3 && j > 0                     && j < 6) {                cout << ch;            }            else if (i > 3 && i < 6                     && j > 4) {                cout << ch;            }            else if (i == 6 && j < 6) {                cout << ch;            }             else                cout << " ";        }        cout << endl;    }} // Function to print the letter Tvoid t(void){    cout << endl;    for (int i = 0; i < 8; i++) {         cout << " ";        for (int t = 0; t < 8; t++) {             if (i < 2 && t < 8) {                cout << ch;            }             if (i > 1 && t < 3)                cout << " ";            if (i > 1 && t > 2                && t < 5) {                cout << ch;            }            if (i > 1 && t > 4)                cout << " ";        }        cout << endl;    }} // Function to print the letter Uvoid u(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";         for (int h = 0; h < 8; h++) {            if (i < 7 && (h < 2 || h > 5)) {                cout << ch;            }            else if (i == 7                     && (h == 0 || h == 7))                cout << " ";            else if (i > 5) {                cout << ch;            }            else                cout << " ";        }        cout << endl;    }} // Function to print the letter Vvoid v(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";        for (int v = 0; v < 8; v++)            if ((v == 0 || v == 7)                && i < 4) {                cout << ch;            }            else if ((v == i - 4 || v == 11 - i)                     && i >= 4) {                cout << ch;            }            else                cout << " ";        cout << endl;    }} // Function to print the letter Wvoid w(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";        for (int j = 0; j < 8; j++) {            if (j == 0 || j == 7) {                cout << ch;            }            else if (i > 3                     && (j == 7 - i || j == i)) {                cout << ch;            }            else                cout << " ";        }        cout << endl;    }} // Function to print the letter Xvoid x(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";        for (int m = 0; m < 8; m++) {            if (i == m || m == 7 - i) {                cout << ch;            }            else                cout << " ";        }         cout << endl;    }} // Function to print the letter Yvoid y(void){    cout << endl;    for (int i = 0; i < 8; i++) {        cout << " ";         for (int y = 0; y < 8; y++) {            if (i < 4) {                if (y == i || y == i + 1                    || y == 6 - i || y == 7 - i) {                    cout << ch;                }                else                    cout << " ";            }            else if (y == 3 || y == 4) {                cout << ch;            }            else                cout << " ";        }        cout << endl;    }} // Function to print the letter Zvoid z(void){    cout << endl;     for (int i = 0; i < 8; i++) {        cout << " ";        for (int j = 0; j < 8; j++) {            if (i == 0 || i == 7) {                cout << ch;            }            else if (j == 7 - i) {                cout << ch;            }            else                cout << " ";        }        cout << endl;    }} // Function to print the required pattern// by taking out each characters in itvoid printPattern(char* str){     int in = 0;     while (str[in]) {         char ch = str[in];        if (ch < 95)            ch = ch + 32;        switch (ch) {        case 'a':            a();            break;        case 'b':            b();            break;        case 'c':            c();            break;        case 'd':            d();            break;        case 'e':            e();            break;        case 'f':            f();            break;        case 'g':            g();            break;        case 'h':            h();            break;        case 'i':            i();            break;        case 'j':            j();            break;        case 'k':            k();            break;        case 'l':            l();            break;        case 'm':            m();            break;        case 'n':            n();            break;        case 'o':            o();            break;        case 'p':            p();            break;        case 'q':            q();            break;        case 'r':            r();            break;        case 's':            s();            break;        case 't':            t();            break;        case 'u':            u();            break;        case 'v':            v();            break;        case 'w':            w();            break;        case 'x':            x();            break;        case 'y':            y();            break;        case 'z':            z();            break;        default:            break;        }        in++;    }} // Driver codeint main(){    ch = '*';    char *str = "GFG";    printPattern(str);     return 0;} // This code is contributed by shubhamsingh
// C Program to print the Alphabets// of a Given Word using * pattern #include <stdio.h>#include <string.h> char ch; // Function to print the letter Avoid a(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");        for (int a = 0; a < 8; a++) {            if (i == 0 && (a == 0 || a == 7))                printf(" ");            else if (a < 2 || a > 5) {                printf("%c", ch);            }            else if (i < 2 || (i > 3 && i < 5)) {                printf("%c", ch);            }             else                printf(" ");        }        printf("\n");    }} // Function to print the letter Bvoid b(void){    printf("\n");    for (int i = 0; i < 9; i++) {        printf(" %c%c", ch, ch);         for (int r = 0; r < 6; r++) {            if (i == 0 && r < 5)                printf("%c", ch);            else if (i == 1)                printf("%c", ch);            else if (i < 4 && i > 0                     && r > 3) {                printf("%c", ch);            }             else if (i == 4 && r < 5) {                printf("%c", ch);            }            else if (i > 4 && i < 7                     && r > 3) {                printf("%c", ch);            }            else if (i == 7) {                printf("%c", ch);            }            else if (i == 8 && r < 5) {                printf("%c", ch);            }             else                printf(" ");        }        printf("\n");    }} // Function to print the letter Cvoid c(void){    printf("\n");    for (int i = 0; i < 8; i++) {         printf(" ");        for (int o = 0; o < 8; o++) {            if (i == 0 && (o <= 1))                printf(" ");            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o > 1)))                printf(" ");            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o > 1)))                printf(" ");            else if ((i == 3 || i == 4                      || i == 5)                     && (o > 0))                printf(" ");            else if (i == 6                     && (o == 0 || o == 8 + 5 - i                         || (o > 1)))                printf(" ");            else if (i == 7                     && (o <= 1))                printf(" ");            else {                printf("%c", ch);            }        }        printf("\n");    }} // Function to print the letter Dvoid d(void){    printf("\n");    for (int i = 0; i < 8; i++) {        {            printf(" %c", ch);        }         for (int o = 0; o < 8; o++) {            if (i == 0 && (o >= 6 - i))                printf(" ");            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o < 6)))                printf(" ");            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o < 6)))                printf(" ");            else if ((i == 3 || i == 4                      || i == 5)                     && (o < 7))                printf(" ");            else if (i == 6                     && (o == 0 || o == 8 + 5 - i                         || (o < 6)))                printf(" ");            else if (i == 7                     && (o >= 6 - i + 7))                printf(" ");            else {                printf("%c", ch);            }        }        printf("\n");    }} // Function to print the letter Evoid e(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");        for (int j = 0; j < 7; j++) {            if (i == 0) {                printf("%c", ch);            }            else if (i > 0 && i < 3                     && j < 2) {                printf("%c", ch);            }            else if (i == 3 && j < 6) {                printf("%c", ch);            }            else if (i > 3 && i < 6                     && j < 2) {                printf("%c", ch);            }            else if (i == 6) {                printf("%c", ch);            }             else                printf(" ");        }        printf("\n");    }} // Function to print the letter Fvoid f(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");        for (int j = 0; j < 7; j++) {            if (i == 0) {                printf("%c", ch);            }            else if (i > 0 && i < 3                     && j < 2) {                printf("%c", ch);            }            else if (i == 3 && j < 6) {                printf("%c", ch);            }            else if (i > 3 && i < 7                     && j < 2) {                printf("%c", ch);            }             else                printf(" ");        }        printf("\n");    }} // Function to print the letter Gvoid g(void){    printf("\n");    for (int i = 0; i < 8; i++) {         printf(" ");        for (int o = 0; o < 8; o++) {            if (i == 4 && o > 3                || (o == 4 || o == 7)                       && i > 4) {                printf("%c", ch);            }             else if (i == 0 && (o <= 1))                printf(" ");            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o > 1)))                printf(" ");            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o > 1)))                printf(" ");            else if ((i == 3 || i == 4                      || i == 5)                     && (o > 0))                printf(" ");            else if (i == 6                     && (o == 0 || (o > 1)))                printf(" ");            else if (i == 7                     && (o <= 1 || o == 5                         || o == 6))                printf(" ");            else {                printf("%c", ch);            }        }        printf("\n");    }} // Function to print the letter Hvoid h(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");        for (int h = 0; h < 8; h++) {            if (h < 2 || h > 5) {                printf("%c", ch);            }            else if (i > 2 && i < 5) {                printf("%c", ch);            }             else                printf(" ");        }        printf("\n");    }} // Function to print the letter Ivoid i(void){    printf("\n");    for (int i = 0; i < 8; i++) {         printf(" ");         for (int t = 0; t < 8; t++) {             if ((i < 1 || i > 6)                && t < 8) {                printf("%c", ch);            }             else if (i > 0 && t < 3)                printf(" ");            else if (i > 0 && t > 2                     && t < 5) {                printf("%c", ch);            }            else if (i > 0 && t > 4)                printf(" ");            else {            }        }        printf("\n");    }} // Function to print the letter Jvoid j(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");         for (int h = 0; h < 8; h++) {            if (i < 1) {                printf("%c", ch);            }            else if (i == 5 && h < 1) {                printf("%c", ch);            }            else if (i < 7 && h > 5) {                printf("%c", ch);            }            else if (i == 7                     && (h == 0 || h == 7))                printf(" ");            else if (i > 5) {                printf("%c", ch);            }            else                printf(" ");        }        printf("\n");    }} // Function to print the letter Kvoid k(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");         for (int k1 = 0; k1 < 7; k1++) {            if (k1 < 2) {                printf("%c", ch);            }            else if ((k1 >= 5 - i)                     && (k1 <= 6 - i)) {                printf("%c", ch);            }             else if (i >= 4) {                if (k1 == i - 2 || k1 == i - 1) {                    printf("%c", ch);                }                else                    printf(" ");            }            else                printf(" ");        }        printf("\n");    }} // Function to print the letter Lvoid l(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");         {            printf("%c%c", ch, ch);        }        if (i == 6) {            {                printf("%c%c", ch, ch);            }            {                printf("%c%c", ch, ch);            }            printf("%c%c", ch, ch);        }        if (i == 7) {            {                printf("%c%c", ch, ch);            }            {                printf("%c%c", ch, ch);            }            printf("%c%c", ch, ch);        }        printf("\n");    }} // Function to print the letter Mvoid m(void){    printf("\n");     for (int i = 0; i < 8; i++) {        printf(" ");        for (int j = 0; j < 8; j++) {            if (j == 0 || j == 7) {                printf("%c", ch);            }            else if (i < 4                     && (j == 7 - i || j == i)) {                printf("%c", ch);            }            else                printf(" ");        }        printf("\n");    }} // Function to print the letter Nvoid n(void){    printf("\n");     for (int i = 0; i < 8; i++) {        printf(" ");        for (int n = 0; n < 8; n++) {            if (n < 2 || n > 5) {                printf("%c", ch);            }            else if (i == n - 1                     || i == n + 1 || i == n) {                printf("%c", ch);            }            else                printf(" ");        }        printf("\n");    }} // Function to print the letter Ovoid o(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");        for (int o = 0; o < 8; o++) {            if (i == 0 && (o <= 1 || o >= 6 - i))                printf(" ");            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o < 6 && o > 1)))                printf(" ");            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o < 6 && o > 1)))                printf(" ");            else if ((i == 3 || i == 4 || i == 5)                     && (o > 0 && o < 7))                printf(" ");            else if (i == 6                     && (o == 0 || o == 8 + 5 - i                         || (o < 6 && o > 1)))                printf(" ");            else if (i == 7                     && (o <= 1 || o >= 6 - i + 7))                printf(" ");            else {                printf("%c", ch);            }        }        printf("\n");    }} // Function to print the letter Pvoid p(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");        {            printf("%c%c", ch, ch);        }         for (int r = 0; r < 6; r++) {            if (i == 0 && r < 5)                printf("%c", ch);            else if (i == 1)                printf("%c", ch);            else if (i < 4 && i > 0 && r > 3) {                printf("%c", ch);            }             else if (i == 4 && r < 5) {                printf("%c", ch);            }            else                printf(" ");        }        printf("\n");    }} // Function to print the letter Qvoid q(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");        for (int o = 0; o < 8; o++) {            if (o == i)                printf("%c", ch);             else if (i == 0                     && (o <= 1 || o >= 6 - i))                printf(" ");            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o < 6 && o > 1)))                printf(" ");            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o < 6 && o > 1)))                printf(" ");            else if ((i == 3 || i == 4 || i == 5)                     && (o > 0 && o < 7))                printf(" ");            else if (i == 6                     && (o == 0 || o == 8 + 5 - i                         || (o < 6 && o > 1)))                printf(" ");            else if (i == 7                     && (o <= 1 || o >= 6 - i + 7))                printf(" ");            else {                printf("%c", ch);            }        }        printf("\n");    }} // Function to print the letter Rvoid r(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");        {            printf("%c%c", ch, ch);        }         for (int r = 0; r < 6; r++) {            if (i == 0 && r < 5)                printf("%c", ch);            else if (i == 1)                printf("%c", ch);            else if (i < 4 && i > 0                     && r > 3) {                printf("%c", ch);            }             else if (i >= 4) {                if (i == 4                    && (r == 3 || r == 4)) {                    printf("%c", ch);                }                 else if (r == i - 2                         || r == i - 3) {                    printf("%c", ch);                }                else                    printf(" ");            }            else                printf(" ");        }        printf("\n");    }} // Function to print the letter Svoid s(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");        for (int j = 0; j < 7; j++) {            if (i == 0 && j > 0) {                printf("%c", ch);            }            else if (i > 0 && i < 3                     && j < 2) {                printf("%c", ch);            }            else if (i == 3 && j > 0                     && j < 6) {                printf("%c", ch);            }            else if (i > 3 && i < 6                     && j > 4) {                printf("%c", ch);            }            else if (i == 6 && j < 6) {                printf("%c", ch);            }             else                printf(" ");        }        printf("\n");    }} // Function to print the letter Tvoid t(void){    printf("\n");    for (int i = 0; i < 8; i++) {         printf(" ");        for (int t = 0; t < 8; t++) {             if (i < 2 && t < 8) {                printf("%c", ch);            }             if (i > 1 && t < 3)                printf(" ");            if (i > 1 && t > 2                && t < 5) {                printf("%c", ch);            }            if (i > 1 && t > 4)                printf(" ");        }        printf("\n");    }} // Function to print the letter Uvoid u(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");         for (int h = 0; h < 8; h++) {            if (i < 7 && (h < 2 || h > 5)) {                printf("%c", ch);            }            else if (i == 7                     && (h == 0 || h == 7))                printf(" ");            else if (i > 5) {                printf("%c", ch);            }            else                printf(" ");        }        printf("\n");    }} // Function to print the letter Vvoid v(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");        for (int v = 0; v < 8; v++)            if ((v == 0 || v == 7)                && i < 4) {                printf("%c", ch);            }            else if ((v == i - 4 || v == 11 - i)                     && i >= 4) {                printf("%c", ch);            }            else                printf(" ");        printf("\n");    }} // Function to print the letter Wvoid w(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");        for (int j = 0; j < 8; j++) {            if (j == 0 || j == 7) {                printf("%c", ch);            }            else if (i > 3                     && (j == 7 - i || j == i)) {                printf("%c", ch);            }            else                printf(" ");        }        printf("\n");    }} // Function to print the letter Xvoid x(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");        for (int m = 0; m < 8; m++) {            if (i == m || m == 7 - i) {                printf("%c", ch);            }            else                printf(" ");        }         printf("\n");    }} // Function to print the letter Yvoid y(void){    printf("\n");    for (int i = 0; i < 8; i++) {        printf(" ");         for (int y = 0; y < 8; y++) {            if (i < 4) {                if (y == i || y == i + 1                    || y == 6 - i || y == 7 - i) {                    printf("%c", ch);                }                else                    printf(" ");            }            else if (y == 3 || y == 4) {                printf("%c", ch);            }            else                printf(" ");        }        printf("\n");    }} // Function to print the letter Zvoid z(void){    printf("\n");     for (int i = 0; i < 8; i++) {        printf(" ");        for (int j = 0; j < 8; j++) {            if (i == 0 || i == 7) {                printf("%c", ch);            }            else if (j == 7 - i) {                printf("%c", ch);            }            else                printf(" ");        }        printf("\n");    }} // Function to print the required pattern// by taking out each characters in itvoid printPattern(char* str){     int in = 0;     while (str[in]) {         char ch = str[in];        if (ch < 95)            ch = ch + 32;        switch (ch) {        case 'a':            a();            break;        case 'b':            b();            break;        case 'c':            c();            break;        case 'd':            d();            break;        case 'e':            e();            break;        case 'f':            f();            break;        case 'g':            g();            break;        case 'h':            h();            break;        case 'i':            i();            break;        case 'j':            j();            break;        case 'k':            k();            break;        case 'l':            l();            break;        case 'm':            m();            break;        case 'n':            n();            break;        case 'o':            o();            break;        case 'p':            p();            break;        case 'q':            q();            break;        case 'r':            r();            break;        case 's':            s();            break;        case 't':            t();            break;        case 'u':            u();            break;        case 'v':            v();            break;        case 'w':            w();            break;        case 'x':            x();            break;        case 'y':            y();            break;        case 'z':            z();            break;        default:            break;        }        in++;    }} // Driver codeint main(){    ch = '*';    char* str = "GFG";    printPattern(str);     return 0;}
// Java Program to print the Alphabets// of a Given Word using * patternclass GFG{  static char ch;  // Function to print the letter Astatic void a(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int a = 0; a < 8; a++) {            if (i == 0 && (a == 0 || a == 7))                System.out.printf(" ");            else if (a < 2 || a > 5) {                System.out.printf("%c", ch);            }            else if (i < 2 || (i > 3 && i < 5)) {                System.out.printf("%c", ch);            }              else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Bstatic void b(){    System.out.printf("\n");    for (int i = 0; i < 9; i++) {        System.out.printf(" %c%c", ch, ch);          for (int r = 0; r < 6; r++) {            if (i == 0 && r < 5)                System.out.printf("%c", ch);            else if (i == 1)                System.out.printf("%c", ch);            else if (i < 4 && i > 0                     && r > 3) {                System.out.printf("%c", ch);            }              else if (i == 4 && r < 5) {                System.out.printf("%c", ch);            }            else if (i > 4 && i < 7                     && r > 3) {                System.out.printf("%c", ch);            }            else if (i == 7) {                System.out.printf("%c", ch);            }            else if (i == 8 && r < 5) {                System.out.printf("%c", ch);            }              else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Cstatic void c(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {          System.out.printf(" ");        for (int o = 0; o < 8; o++) {            if (i == 0 && (o <= 1))                System.out.printf(" ");            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o > 1)))                System.out.printf(" ");            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o > 1)))                System.out.printf(" ");            else if ((i == 3 || i == 4                      || i == 5)                     && (o > 0))                System.out.printf(" ");            else if (i == 6                     && (o == 0 || o == 8 + 5 - i                         || (o > 1)))                System.out.printf(" ");            else if (i == 7                     && (o <= 1))                System.out.printf(" ");            else {                System.out.printf("%c", ch);            }        }        System.out.printf("\n");    }}  // Function to print the letter Dstatic void d(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        {            System.out.printf(" %c", ch);        }          for (int o = 0; o < 8; o++) {            if (i == 0 && (o >= 6 - i))                System.out.printf(" ");            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o < 6)))                System.out.printf(" ");            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o < 6)))                System.out.printf(" ");            else if ((i == 3 || i == 4                      || i == 5)                     && (o < 7))                System.out.printf(" ");            else if (i == 6                     && (o == 0 || o == 8 + 5 - i                         || (o < 6)))                System.out.printf(" ");            else if (i == 7                     && (o >= 6 - i + 7))                System.out.printf(" ");            else {                System.out.printf("%c", ch);            }        }        System.out.printf("\n");    }}  // Function to print the letter Estatic void e(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int j = 0; j < 7; j++) {            if (i == 0) {                System.out.printf("%c", ch);            }            else if (i > 0 && i < 3                     && j < 2) {                System.out.printf("%c", ch);            }            else if (i == 3 && j < 6) {                System.out.printf("%c", ch);            }            else if (i > 3 && i < 6                     && j < 2) {                System.out.printf("%c", ch);            }            else if (i == 6) {                System.out.printf("%c", ch);            }              else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Fstatic void f(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int j = 0; j < 7; j++) {            if (i == 0) {                System.out.printf("%c", ch);            }            else if (i > 0 && i < 3                     && j < 2) {                System.out.printf("%c", ch);            }            else if (i == 3 && j < 6) {                System.out.printf("%c", ch);            }            else if (i > 3 && i < 7                     && j < 2) {                System.out.printf("%c", ch);            }              else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Gstatic void g(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {          System.out.printf(" ");        for (int o = 0; o < 8; o++) {            if (i == 4 && o > 3                || (o == 4 || o == 7)                       && i > 4) {                System.out.printf("%c", ch);            }              else if (i == 0 && (o <= 1))                System.out.printf(" ");            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o > 1)))                System.out.printf(" ");            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o > 1)))                System.out.printf(" ");            else if ((i == 3 || i == 4                      || i == 5)                     && (o > 0))                System.out.printf(" ");            else if (i == 6                     && (o == 0 || (o > 1)))                System.out.printf(" ");            else if (i == 7                     && (o <= 1 || o == 5                         || o == 6))                System.out.printf(" ");            else {                System.out.printf("%c", ch);            }        }        System.out.printf("\n");    }}  // Function to print the letter Hstatic void h(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int h = 0; h < 8; h++) {            if (h < 2 || h > 5) {                System.out.printf("%c", ch);            }            else if (i > 2 && i < 5) {                System.out.printf("%c", ch);            }              else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Istatic void i(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {          System.out.printf(" ");          for (int t = 0; t < 8; t++) {              if ((i < 1 || i > 6)                && t < 8) {                System.out.printf("%c", ch);            }              else if (i > 0 && t < 3)                System.out.printf(" ");            else if (i > 0 && t > 2                     && t < 5) {                System.out.printf("%c", ch);            }            else if (i > 0 && t > 4)                System.out.printf(" ");            else {            }        }        System.out.printf("\n");    }}  // Function to print the letter Jstatic void j(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");          for (int h = 0; h < 8; h++) {            if (i < 1) {                System.out.printf("%c", ch);            }            else if (i == 5 && h < 1) {                System.out.printf("%c", ch);            }            else if (i < 7 && h > 5) {                System.out.printf("%c", ch);            }            else if (i == 7                     && (h == 0 || h == 7))                System.out.printf(" ");            else if (i > 5) {                System.out.printf("%c", ch);            }            else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Kstatic void k(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");          for (int k1 = 0; k1 < 7; k1++) {            if (k1 < 2) {                System.out.printf("%c", ch);            }            else if ((k1 >= 5 - i)                     && (k1 <= 6 - i)) {                System.out.printf("%c", ch);            }              else if (i >= 4) {                if (k1 == i - 2 || k1 == i - 1) {                    System.out.printf("%c", ch);                }                else                    System.out.printf(" ");            }            else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Lstatic void l(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");          {            System.out.printf("%c%c", ch, ch);        }        if (i == 6) {            {                System.out.printf("%c%c", ch, ch);            }            {                System.out.printf("%c%c", ch, ch);            }            System.out.printf("%c%c", ch, ch);        }        if (i == 7) {            {                System.out.printf("%c%c", ch, ch);            }            {                System.out.printf("%c%c", ch, ch);            }            System.out.printf("%c%c", ch, ch);        }        System.out.printf("\n");    }}  // Function to print the letter Mstatic void m(){    System.out.printf("\n");      for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int j = 0; j < 8; j++) {            if (j == 0 || j == 7) {                System.out.printf("%c", ch);            }            else if (i < 4                     && (j == 7 - i || j == i)) {                System.out.printf("%c", ch);            }            else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Nstatic void n(){    System.out.printf("\n");      for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int n = 0; n < 8; n++) {            if (n < 2 || n > 5) {                System.out.printf("%c", ch);            }            else if (i == n - 1                     || i == n + 1 || i == n) {                System.out.printf("%c", ch);            }            else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Ostatic void o(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int o = 0; o < 8; o++) {            if (i == 0 && (o <= 1 || o >= 6 - i))                System.out.printf(" ");            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o < 6 && o > 1)))                System.out.printf(" ");            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o < 6 && o > 1)))                System.out.printf(" ");            else if ((i == 3 || i == 4 || i == 5)                     && (o > 0 && o < 7))                System.out.printf(" ");            else if (i == 6                     && (o == 0 || o == 8 + 5 - i                         || (o < 6 && o > 1)))                System.out.printf(" ");            else if (i == 7                     && (o <= 1 || o >= 6 - i + 7))                System.out.printf(" ");            else {                System.out.printf("%c", ch);            }        }        System.out.printf("\n");    }}  // Function to print the letter Pstatic void p(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");        {            System.out.printf("%c%c", ch, ch);        }          for (int r = 0; r < 6; r++) {            if (i == 0 && r < 5)                System.out.printf("%c", ch);            else if (i == 1)                System.out.printf("%c", ch);            else if (i < 4 && i > 0 && r > 3) {                System.out.printf("%c", ch);            }              else if (i == 4 && r < 5) {                System.out.printf("%c", ch);            }            else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Qstatic void q(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int o = 0; o < 8; o++) {            if (o == i)                System.out.printf("%c", ch);              else if (i == 0                     && (o <= 1 || o >= 6 - i))                System.out.printf(" ");            else if (i == 1                     && (o == 0 || o == 8 - i                         || (o < 6 && o > 1)))                System.out.printf(" ");            else if (i == 2                     && (o == 1 || o == 8 - i                         || (o < 6 && o > 1)))                System.out.printf(" ");            else if ((i == 3 || i == 4 || i == 5)                     && (o > 0 && o < 7))                System.out.printf(" ");            else if (i == 6                     && (o == 0 || o == 8 + 5 - i                         || (o < 6 && o > 1)))                System.out.printf(" ");            else if (i == 7                     && (o <= 1 || o >= 6 - i + 7))                System.out.printf(" ");            else {                System.out.printf("%c", ch);            }        }        System.out.printf("\n");    }}  // Function to print the letter Rstatic void r(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");        {            System.out.printf("%c%c", ch, ch);        }          for (int r = 0; r < 6; r++) {            if (i == 0 && r < 5)                System.out.printf("%c", ch);            else if (i == 1)                System.out.printf("%c", ch);            else if (i < 4 && i > 0                     && r > 3) {                System.out.printf("%c", ch);            }              else if (i >= 4) {                if (i == 4                    && (r == 3 || r == 4)) {                    System.out.printf("%c", ch);                }                  else if (r == i - 2                         || r == i - 3) {                    System.out.printf("%c", ch);                }                else                    System.out.printf(" ");            }            else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Sstatic void s(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int j = 0; j < 7; j++) {            if (i == 0 && j > 0) {                System.out.printf("%c", ch);            }            else if (i > 0 && i < 3                     && j < 2) {                System.out.printf("%c", ch);            }            else if (i == 3 && j > 0                     && j < 6) {                System.out.printf("%c", ch);            }            else if (i > 3 && i < 6                     && j > 4) {                System.out.printf("%c", ch);            }            else if (i == 6 && j < 6) {                System.out.printf("%c", ch);            }              else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Tstatic void t(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {          System.out.printf(" ");        for (int t = 0; t < 8; t++) {              if (i < 2 && t < 8) {                System.out.printf("%c", ch);            }              if (i > 1 && t < 3)                System.out.printf(" ");            if (i > 1 && t > 2                && t < 5) {                System.out.printf("%c", ch);            }            if (i > 1 && t > 4)                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Ustatic void u(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");          for (int h = 0; h < 8; h++) {            if (i < 7 && (h < 2 || h > 5)) {                System.out.printf("%c", ch);            }            else if (i == 7                     && (h == 0 || h == 7))                System.out.printf(" ");            else if (i > 5) {                System.out.printf("%c", ch);            }            else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Vstatic void v(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int v = 0; v < 8; v++)            if ((v == 0 || v == 7)                && i < 4) {                System.out.printf("%c", ch);            }            else if ((v == i - 4 || v == 11 - i)                     && i >= 4) {                System.out.printf("%c", ch);            }            else                System.out.printf(" ");        System.out.printf("\n");    }}  // Function to print the letter Wstatic void w(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int j = 0; j < 8; j++) {            if (j == 0 || j == 7) {                System.out.printf("%c", ch);            }            else if (i > 3                     && (j == 7 - i || j == i)) {                System.out.printf("%c", ch);            }            else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Xstatic void x(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int m = 0; m < 8; m++) {            if (i == m || m == 7 - i) {                System.out.printf("%c", ch);            }            else                System.out.printf(" ");        }          System.out.printf("\n");    }}  // Function to print the letter Ystatic void y(){    System.out.printf("\n");    for (int i = 0; i < 8; i++) {        System.out.printf(" ");          for (int y = 0; y < 8; y++) {            if (i < 4) {                if (y == i || y == i + 1                    || y == 6 - i || y == 7 - i) {                    System.out.printf("%c", ch);                }                else                    System.out.printf(" ");            }            else if (y == 3 || y == 4) {                System.out.printf("%c", ch);            }            else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the letter Zstatic void z(){    System.out.printf("\n");      for (int i = 0; i < 8; i++) {        System.out.printf(" ");        for (int j = 0; j < 8; j++) {            if (i == 0 || i == 7) {                System.out.printf("%c", ch);            }            else if (j == 7 - i) {                System.out.printf("%c", ch);            }            else                System.out.printf(" ");        }        System.out.printf("\n");    }}  // Function to print the required pattern// by taking out each characters in itstatic void printPattern(char[] str){      int in = 0;      while (in<str.length) {          char ch = str[in];        if (ch < 95)            ch = (char) (ch + 32);        switch (ch) {        case 'a':            a();            break;        case 'b':            b();            break;        case 'c':            c();            break;        case 'd':            d();            break;        case 'e':            e();            break;        case 'f':            f();            break;        case 'g':            g();            break;        case 'h':            h();            break;        case 'i':            i();            break;        case 'j':            j();            break;        case 'k':            k();            break;        case 'l':            l();            break;        case 'm':            m();            break;        case 'n':            n();            break;        case 'o':            o();            break;        case 'p':            p();            break;        case 'q':            q();            break;        case 'r':            r();            break;        case 's':            s();            break;        case 't':            t();            break;        case 'u':            u();            break;        case 'v':            v();            break;        case 'w':            w();            break;        case 'x':            x();            break;        case 'y':            y();            break;        case 'z':            z();            break;        default:            break;        }        in++;    }}  // Driver codepublic static void main(String[] args){    ch = '*';    char[] str = "GFG".toCharArray();    printPattern(str);  }} // This code contributed by Rajput-Ji
// C# Program to print the Alphabets// of a Given Word using * patternusing System; class GFG{ static char ch; // Function to print the letter Astatic void a(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int a = 0; a < 8; a++) {            if (i == 0 && (a == 0 || a == 7))                Console.Write(" ");            else if (a < 2 || a > 5) {                Console.Write("{0}", ch);            }            else if (i < 2 || (i > 3 && i < 5)) {                Console.Write("{0}", ch);            }             else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Bstatic void b(){    Console.Write("\n");    for (int i = 0; i < 9; i++) {        Console.Write(" {0}{0}", ch, ch);         for (int r = 0; r < 6; r++) {            if (i == 0 && r < 5)                Console.Write("{0}", ch);            else if (i == 1)                Console.Write("{0}", ch);            else if (i < 4 && i > 0                    && r > 3) {                Console.Write("{0}", ch);            }             else if (i == 4 && r < 5) {                Console.Write("{0}", ch);            }            else if (i > 4 && i < 7                    && r > 3) {                Console.Write("{0}", ch);            }            else if (i == 7) {                Console.Write("{0}", ch);            }            else if (i == 8 && r < 5) {                Console.Write("{0}", ch);            }             else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Cstatic void c(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {         Console.Write(" ");        for (int o = 0; o < 8; o++) {            if (i == 0 && (o <= 1))                Console.Write(" ");            else if (i == 1                    && (o == 0 || o == 8 - i                        || (o > 1)))                Console.Write(" ");            else if (i == 2                    && (o == 1 || o == 8 - i                        || (o > 1)))                Console.Write(" ");            else if ((i == 3 || i == 4                    || i == 5)                    && (o > 0))                Console.Write(" ");            else if (i == 6                    && (o == 0 || o == 8 + 5 - i                        || (o > 1)))                Console.Write(" ");            else if (i == 7                    && (o <= 1))                Console.Write(" ");            else {                Console.Write("{0}", ch);            }        }        Console.Write("\n");    }} // Function to print the letter Dstatic void d(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        {            Console.Write(" {0}", ch);        }         for (int o = 0; o < 8; o++) {            if (i == 0 && (o >= 6 - i))                Console.Write(" ");            else if (i == 1                    && (o == 0 || o == 8 - i                        || (o < 6)))                Console.Write(" ");            else if (i == 2                    && (o == 1 || o == 8 - i                        || (o < 6)))                Console.Write(" ");            else if ((i == 3 || i == 4                    || i == 5)                    && (o < 7))                Console.Write(" ");            else if (i == 6                    && (o == 0 || o == 8 + 5 - i                        || (o < 6)))                Console.Write(" ");            else if (i == 7                    && (o >= 6 - i + 7))                Console.Write(" ");            else {                Console.Write("{0}", ch);            }        }        Console.Write("\n");    }} // Function to print the letter Estatic void e(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int j = 0; j < 7; j++) {            if (i == 0) {                Console.Write("{0}", ch);            }            else if (i > 0 && i < 3                    && j < 2) {                Console.Write("{0}", ch);            }            else if (i == 3 && j < 6) {                Console.Write("{0}", ch);            }            else if (i > 3 && i < 6                    && j < 2) {                Console.Write("{0}", ch);            }            else if (i == 6) {                Console.Write("{0}", ch);            }             else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Fstatic void f(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int j = 0; j < 7; j++) {            if (i == 0) {                Console.Write("{0}", ch);            }            else if (i > 0 && i < 3                    && j < 2) {                Console.Write("{0}", ch);            }            else if (i == 3 && j < 6) {                Console.Write("{0}", ch);            }            else if (i > 3 && i < 7                    && j < 2) {                Console.Write("{0}", ch);            }             else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Gstatic void g(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {         Console.Write(" ");        for (int o = 0; o < 8; o++) {            if (i == 4 && o > 3                || (o == 4 || o == 7)                    && i > 4) {                Console.Write("{0}", ch);            }             else if (i == 0 && (o <= 1))                Console.Write(" ");            else if (i == 1                    && (o == 0 || o == 8 - i                        || (o > 1)))                Console.Write(" ");            else if (i == 2                    && (o == 1 || o == 8 - i                        || (o > 1)))                Console.Write(" ");            else if ((i == 3 || i == 4                    || i == 5)                    && (o > 0))                Console.Write(" ");            else if (i == 6                    && (o == 0 || (o > 1)))                Console.Write(" ");            else if (i == 7                    && (o <= 1 || o == 5                        || o == 6))                Console.Write(" ");            else {                Console.Write("{0}", ch);            }        }        Console.Write("\n");    }} // Function to print the letter Hstatic void h(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int h = 0; h < 8; h++) {            if (h < 2 || h > 5) {                Console.Write("{0}", ch);            }            else if (i > 2 && i < 5) {                Console.Write("{0}", ch);            }             else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Istatic void i(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {         Console.Write(" ");         for (int t = 0; t < 8; t++) {             if ((i < 1 || i > 6)                && t < 8) {                Console.Write("{0}", ch);            }             else if (i > 0 && t < 3)                Console.Write(" ");            else if (i > 0 && t > 2                    && t < 5) {                Console.Write("{0}", ch);            }            else if (i > 0 && t > 4)                Console.Write(" ");            else {            }        }        Console.Write("\n");    }} // Function to print the letter Jstatic void j(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");         for (int h = 0; h < 8; h++) {            if (i < 1) {                Console.Write("{0}", ch);            }            else if (i == 5 && h < 1) {                Console.Write("{0}", ch);            }            else if (i < 7 && h > 5) {                Console.Write("{0}", ch);            }            else if (i == 7                    && (h == 0 || h == 7))                Console.Write(" ");            else if (i > 5) {                Console.Write("{0}", ch);            }            else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Kstatic void k(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");         for (int k1 = 0; k1 < 7; k1++) {            if (k1 < 2) {                Console.Write("{0}", ch);            }            else if ((k1 >= 5 - i)                    && (k1 <= 6 - i)) {                Console.Write("{0}", ch);            }             else if (i >= 4) {                if (k1 == i - 2 || k1 == i - 1) {                    Console.Write("{0}", ch);                }                else                    Console.Write(" ");            }            else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Lstatic void l(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");         {            Console.Write("{0}{0}", ch, ch);        }        if (i == 6) {            {                Console.Write("{0}{0}", ch, ch);            }            {                Console.Write("{0}{0}", ch, ch);            }            Console.Write("{0}{0}", ch, ch);        }        if (i == 7) {            {                Console.Write("{0}{0}", ch, ch);            }            {                Console.Write("{0}{0}", ch, ch);            }            Console.Write("{0}{0}", ch, ch);        }        Console.Write("\n");    }} // Function to print the letter Mstatic void m(){    Console.Write("\n");     for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int j = 0; j < 8; j++) {            if (j == 0 || j == 7) {                Console.Write("{0}", ch);            }            else if (i < 4                    && (j == 7 - i || j == i)) {                Console.Write("{0}", ch);            }            else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Nstatic void n(){    Console.Write("\n");     for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int n = 0; n < 8; n++) {            if (n < 2 || n > 5) {                Console.Write("{0}", ch);            }            else if (i == n - 1                    || i == n + 1 || i == n) {                Console.Write("{0}", ch);            }            else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Ostatic void o(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int o = 0; o < 8; o++) {            if (i == 0 && (o <= 1 || o >= 6 - i))                Console.Write(" ");            else if (i == 1                    && (o == 0 || o == 8 - i                        || (o < 6 && o > 1)))                Console.Write(" ");            else if (i == 2                    && (o == 1 || o == 8 - i                        || (o < 6 && o > 1)))                Console.Write(" ");            else if ((i == 3 || i == 4 || i == 5)                    && (o > 0 && o < 7))                Console.Write(" ");            else if (i == 6                    && (o == 0 || o == 8 + 5 - i                        || (o < 6 && o > 1)))                Console.Write(" ");            else if (i == 7                    && (o <= 1 || o >= 6 - i + 7))                Console.Write(" ");            else {                Console.Write("{0}", ch);            }        }        Console.Write("\n");    }} // Function to print the letter Pstatic void p(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");        {            Console.Write("{0}{0}", ch, ch);        }         for (int r = 0; r < 6; r++) {            if (i == 0 && r < 5)                Console.Write("{0}", ch);            else if (i == 1)                Console.Write("{0}", ch);            else if (i < 4 && i > 0 && r > 3) {                Console.Write("{0}", ch);            }             else if (i == 4 && r < 5) {                Console.Write("{0}", ch);            }            else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Qstatic void q(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int o = 0; o < 8; o++) {            if (o == i)                Console.Write("{0}", ch);             else if (i == 0                    && (o <= 1 || o >= 6 - i))                Console.Write(" ");            else if (i == 1                    && (o == 0 || o == 8 - i                        || (o < 6 && o > 1)))                Console.Write(" ");            else if (i == 2                    && (o == 1 || o == 8 - i                        || (o < 6 && o > 1)))                Console.Write(" ");            else if ((i == 3 || i == 4 || i == 5)                    && (o > 0 && o < 7))                Console.Write(" ");            else if (i == 6                    && (o == 0 || o == 8 + 5 - i                        || (o < 6 && o > 1)))                Console.Write(" ");            else if (i == 7                    && (o <= 1 || o >= 6 - i + 7))                Console.Write(" ");            else {                Console.Write("{0}", ch);            }        }        Console.Write("\n");    }} // Function to print the letter Rstatic void r(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");        {            Console.Write("{0}{0}", ch, ch);        }         for (int r = 0; r < 6; r++) {            if (i == 0 && r < 5)                Console.Write("{0}", ch);            else if (i == 1)                Console.Write("{0}", ch);            else if (i < 4 && i > 0                    && r > 3) {                Console.Write("{0}", ch);            }             else if (i >= 4) {                if (i == 4                    && (r == 3 || r == 4)) {                    Console.Write("{0}", ch);                }                 else if (r == i - 2                        || r == i - 3) {                    Console.Write("{0}", ch);                }                else                    Console.Write(" ");            }            else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Sstatic void s(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int j = 0; j < 7; j++) {            if (i == 0 && j > 0) {                Console.Write("{0}", ch);            }            else if (i > 0 && i < 3                    && j < 2) {                Console.Write("{0}", ch);            }            else if (i == 3 && j > 0                    && j < 6) {                Console.Write("{0}", ch);            }            else if (i > 3 && i < 6                    && j > 4) {                Console.Write("{0}", ch);            }            else if (i == 6 && j < 6) {                Console.Write("{0}", ch);            }             else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Tstatic void t(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {         Console.Write(" ");        for (int t = 0; t < 8; t++) {             if (i < 2 && t < 8) {                Console.Write("{0}", ch);            }             if (i > 1 && t < 3)                Console.Write(" ");            if (i > 1 && t > 2                && t < 5) {                Console.Write("{0}", ch);            }            if (i > 1 && t > 4)                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Ustatic void u(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");         for (int h = 0; h < 8; h++) {            if (i < 7 && (h < 2 || h > 5)) {                Console.Write("{0}", ch);            }            else if (i == 7                    && (h == 0 || h == 7))                Console.Write(" ");            else if (i > 5) {                Console.Write("{0}", ch);            }            else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Vstatic void v(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int v = 0; v < 8; v++)            if ((v == 0 || v == 7)                && i < 4) {                Console.Write("{0}", ch);            }            else if ((v == i - 4 || v == 11 - i)                    && i >= 4) {                Console.Write("{0}", ch);            }            else                Console.Write(" ");        Console.Write("\n");    }} // Function to print the letter Wstatic void w(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int j = 0; j < 8; j++) {            if (j == 0 || j == 7) {                Console.Write("{0}", ch);            }            else if (i > 3                    && (j == 7 - i || j == i)) {                Console.Write("{0}", ch);            }            else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Xstatic void x(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int m = 0; m < 8; m++) {            if (i == m || m == 7 - i) {                Console.Write("{0}", ch);            }            else                Console.Write(" ");        }         Console.Write("\n");    }} // Function to print the letter Ystatic void y(){    Console.Write("\n");    for (int i = 0; i < 8; i++) {        Console.Write(" ");         for (int y = 0; y < 8; y++) {            if (i < 4) {                if (y == i || y == i + 1                    || y == 6 - i || y == 7 - i) {                    Console.Write("{0}", ch);                }                else                    Console.Write(" ");            }            else if (y == 3 || y == 4) {                Console.Write("{0}", ch);            }            else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the letter Zstatic void z(){    Console.Write("\n");     for (int i = 0; i < 8; i++) {        Console.Write(" ");        for (int j = 0; j < 8; j++) {            if (i == 0 || i == 7) {                Console.Write("{0}", ch);            }            else if (j == 7 - i) {                Console.Write("{0}", ch);            }            else                Console.Write(" ");        }        Console.Write("\n");    }} // Function to print the required pattern// by taking out each characters in itstatic void printPattern(char[] str){     int iN = 0;     while (iN<str.Length) {         char ch = str[iN];        if (ch < 95)            ch = (char) (ch + 32);        switch (ch) {        case 'a':            a();            break;        case 'b':            b();            break;        case 'c':            c();            break;        case 'd':            d();            break;        case 'e':            e();            break;        case 'f':            f();            break;        case 'g':            g();            break;        case 'h':            h();            break;        case 'i':            i();            break;        case 'j':            j();            break;        case 'k':            k();            break;        case 'l':            l();            break;        case 'm':            m();            break;        case 'n':            n();            break;        case 'o':            o();            break;        case 'p':            p();            break;        case 'q':            q();            break;        case 'r':            r();            break;        case 's':            s();            break;        case 't':            t();            break;        case 'u':            u();            break;        case 'v':            v();            break;        case 'w':            w();            break;        case 'x':            x();            break;        case 'y':            y();            break;        case 'z':            z();            break;        default:            break;        }        iN++;    }} // Driver codepublic static void Main(String[] args){    ch = '*';    char[] str = "GFG".ToCharArray();    printPattern(str); }}// This code is contributed by 29AjayKumar
   ******
  *      
 *       
 *       
 *   ****
 *   *  *
  *  *  *
   ***  *

 *******
 **     
 **     
 ****** 
 **     
 **     
 **     
        

   ******
  *      
 *       
 *       
 *   ****
 *   *  *
  *  *  *
   ***  *
 
Rajput-Ji
29AjayKumar
SHUBHAMSINGH10
pattern-printing
C Programs
C++ Programs
pattern-printing
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
C Program to read contents of Whole File
Producer Consumer Problem in C
Difference between break and continue statement in C
C Hello World Program
Exit codes in C/C++ with Examples
Sorting a Map by value in C++ STL
Shallow Copy and Deep Copy in C++
C++ program for hashing with chaining
C++ Program to check if a given String is Palindrome or not
delete keyword in C++