Wednesday 22 August 2012

Loop control structure058

Write a program to construct  the image shown below.
                                 1
                               2  3
                            4   5  6
                          7   8   9  10  

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

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



Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...