Wednesday 22 August 2012

Loop control structure059

Write a program to construct  the image shown below.
                                            1
                                           22
                                         3333
                                       444444
                                    555555555
                                  66666666666
                                7777777777777
                              888888888888888
                            99999999999999999 



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

void main ( )
{
                int          i, j, k;
                clrscr ( );
                                             
                printf ("\n\t\t\t   Design of Numbers");
                printf ("\n\n\n");
                                     
                for ( i = 1; i <= 9; i++ )
                {                                   
                                for ( k = 35; k >= i; k-- )
                                {                                     
                                                   printf (" ");
                                }                       
                                for ( j = 1; j <= 2 * i - 1; j++)
                                {                                        
                                                   printf ("%d", i);
                                }
                                printf ("\n");
                }
                getch ( );
}



Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...