Click the Follow Button

C; How to print letter with array.

Letter : P

Program:

#include<stdio.h>

int main ()
{
    int i, j;
    int a [6][3] =
    {
        {1, 1, 1},
        {1, 0, 1},
        {1, 1, 1},
        {1, 0, 0},
        {1, 0, 0},
        {1, 0, 0},
    };

    for (i = 0; i < 6; i++)
    {
        for(j = 0; j < 3; j++)
        {
            if (a[i][j] == 1)
            {
            printf("*  ");
            }

            if (a[i][j] == 0)
            printf("   ");
        }
        printf("\n");
    }

    return 0;
}

Output:

*  *  *  
*     *
*  *  *  
*
*
*

Comments

Popular Posts

TIC - TAC - TOE

Prime and not prime number

do_while loop is to do something again and again