Contact Learn C
Copy

Program 363: Print Numerical Hollow Parallelogram pattern

Program 363: Print Numerical 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("%d",i);      
     }   
     if(i!=size)
     {
       for(k=1;k<=space;k++)
       {
         printf(" ");
       }
        space+=2;
     }
     for(j=i;j>=1;j--)
     {
      if(j!=size)
      printf("%d",i);
     }
     
     printf("\n");
     
    }
    
   //Reverse printing
    space-=4;
    for(i=2;i<=size;i++)
    {
     for(j=1;j<=i;j++)
     {
      printf("%d",i);      
     }   
     if(i!=size)
     {
       for(k=1;k<=space;k++)
       {
         printf(" ");
       }
        space-=2;
     }
     for(j=i;j>=1;j--)
     {
      if(j!=size)
      printf("%d",i);
     }
     
     printf("\n");
     
    }
}
Explanation:
 //Coming Soon


Output:


Print Numerical Hollow Parallelogram pattern
Print Numerical Hollow Parallelogram pattern

6 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. hi sir i want program for below output
    12345
    12 45
    1 5
    12 45
    12345

    ReplyDelete
    Replies
    1. hello sir above out there is 3 spaces between 1 5 at 3rd line

      Delete
    2. hello sir i am waiting for your solutions please help me on this

      Delete
  3. I can’t believe focusing long enough to research; much less write this kind of article. You’ve outdone yourself with this material without a doubt. It is one of the greatest contents. stl finder

    ReplyDelete
  4. I definitely enjoying every little bit of it. It is a great website and nice share. I want to thank you. Good job! You guys do a great blog, and have some great contents. Keep up the good work. 3d printer price range

    ReplyDelete

Donate

Download App and Learn when ever you want

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