Thursday 29 March 2018

Pattern Program using C


#include <stdio.h>
int main()
{
   int i,j,k,m,space, rows;
   scanf("%d\n",&rows);
   for(i=0; i<=rows; i++)
   {
       for(space=0; space<=rows-i; ++space)
       {
           printf("  ");
       }
       for(j=i;j>=0;j--)
       {
           printf("%d ",j);
           m=j;
           if(m==0)
           {
               for(k=1;k<=i;k++)
               {
                   printf("%d ",k);
               }
           }
       }
       printf("\n");
   }
   return 0;
}

Output:  

No comments:

Post a Comment

Infinite scroll on collection page in Shopify

 Hello, Collection page structure is as followed {% paginate collection.products by 48 %} <div class="collection-content"> ...