Wednesday 22 August 2012

Loop control structure057

Write a program to construct  the image shown below.
                             1
                           232
                         34543
                       4567654
                     567898765


#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 <= 5; i++ )
            {                                     
                            for ( k = 35; k >= i; k-- )
                            {                                     
                                               printf (" ");
                            }                                       
                            for ( j = i; j <= m; j++)
                            {                                       
                                               printf ("%d", j);
                            }                       
                            for ( j = m - 1; j >= i; j-- )
                            {                                         
                                               printf ("%d", j);
                            }
                            m = m +2;
                            printf ("\n");
            }
            getch ( );
}



Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...