Friday, 4 April 2014

How To Print Various Type Of Pattern In C

Output:

55555
54444
54333
54322
54321

Code:

#include<stdio.h>
#include<conio.h>
main()
      {
       int i,j,k,n;
       for(i=5;i>=1;i--)
                        {
                         for(j=5;j>=i;j--)
                                          {
                                           printf(" %d",j);
                                          }
                         for(k=i;k>1;k--)
                                          {
                                           printf(" %d",i);
                                          }  
                        printf("\n");
                        } 
       getch();        
      }

No comments:

Post a Comment