Advertisement

Digit Pyramid 5 lines

#include<stdio.h>
#include<conio.h>
#include<math.h>

main(){
      
       int i,j,k,l,m;
      
      
      
       for(i=1;i<=5;i++){
                         for(j=5;j>=i;j--){
                                            printf("  ");
                                            }
                         for(k=i;k<=2*i-1;k++){
                                               printf("%d ",k);
                                              }
                        
                         for(l=2*i-2;l>=i;l--){
                                               printf("%d ",l);
                                               }
                       
                        
                                             
                        
                         printf("\n");
                         }

      
       getch();
       }
      
     
      
             
                  
                            
      

                
                
                     
       

No comments:

Post a Comment

Please comment bellow. Share your knowledge