Contact Learn C
Copy

Program 375: Print Alphabetical Hollow Parallelogram pattern

Program 375: Print Alphabetical Hollow Parallelogram pattern
 
#include<stdio.h>
main()
{
    int i,j,k=0,space=1,size;
    printf("Enter size\n");
    scanf("%d",&size);
    for(i=size;i>=1;i--)
    {
     for(j=1;j<=i;j++)
     {
      printf("%c",i+64);      
     }   
     if(i!=size)
     {
       for(k=1;k<=space;k++)
       {
         printf(" ");
       }
        space+=2;
     }
     for(j=i;j>=1;j--)
     {
      if(j!=size)
      printf("%c",i+64);
     }
     
     printf("\n");
     
    }
    
   //Reverse printing
    space-=4;
    for(i=2;i<=size;i++)
    {
     for(j=1;j<=i;j++)
     {
      printf("%c",i+64);      
     }   
     if(i!=size)
     {
       for(k=1;k<=space;k++)
       {
         printf(" ");
       }
        space-=2;
     }
     for(j=i;j>=1;j--)
     {
      if(j!=size)
      printf("%c",i+64);
     }
     
     printf("\n");
     
    }
}
Explanation:
 //Coming Soon


Output:
Print Alphabetical Hollow Parallelogram pattern


Donate

Download App and Learn when ever you want

Get it on PlayStore
Get it on Amazon App Store
Get it on Aptoide