Saturday 25 August 2012

Loop control structure066

Write a program to construct this figure.
                                              9
                                            8 8
                                          7 7  7
                                        6 6  6  6 
                                     5  5  5  5  5
                                   4  4  4  4  4  4
                                 3  3  3  3  3  3  3
                               2  2  2  2  2  2  2  2
                             1  1  1  1  1  1  1  1  1


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

void main ( )
{
       int         i, j, k, l = 35;
       clrscr ( );

       printf ("\n\t\t\t    Design of Numbers\n\n\n");

       for ( i = 9; i >= 1; i-- )
       {
                for ( j = 0; j < l; j++ )
                {
                         printf(" ");
                }
                for ( k = 1; k <= 10 - i; k++ )
                {
                         printf ("%d ", i);
                }
                printf ( "\n" );
                l--;
           }
           getch( );
}



Click here to contact us 

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...