pTutorial

New way to learn C programming

C Program to print Alphabetical pattern

These C program prints different alphabet pattern like alphabetical triangle pattern. These codes explain how to create alphabetical pattern C program. Pattern program is nothing it just a game of loops. Most of the pattern program use loop within loop with ASCII value.

Alphabetical tringle c program



#include <stdio.h>

#include <conio.h>

void main()
{
    int u, n, p;
    char str = 'a';
    printf("Please enter number of rows\n");
    scanf("%d",&n);
    for ( u = 1 ; u <= n ; u++ )
    {
        for ( p = 1 ; p <= u ; p++)
            printf("%c",str);
        printf("\n");
        str++;
    }
    getch();
}

Download Pattern C Program

Output of program

C pattern Program

The above c Example use the concept of ASCII value to print alphabet in ascending order

C program to print pattern

#include <stdio.h>
#include <conio.h>
void main()
{
   int a, z, k, space = 0;
   char ch, tv;
   printf("Please enter the number of Rows");
   printf("\nTo print alphabeticle pattern");
   scanf("%d", &a);
   ch = 'A'+a-1;
   tv = ch;
   
   for ( k = a ; k >= 1 ; k-- )
   {
      for ( z = 1 ; z <= space; z++)
         printf(" ");
      space++;
      for ( z = 1 ; z <= k ; z++ )
      {
         printf("%c",tv);
         tv--;
      }
       printf("\n");
    ch--;
      tv = ch;
    }
   
} 

Download C pattern Program

See Also

How to create war file in eclipse   |   How to locate php.ini file on server   |   Contact us

QUOTES OF THE DAY

The ballot is stronger than bullet.

LIKE ON FACEBOOK

+1 ON GOOGLE

SHARE ON TWITTER