Tuesday 21 August 2012

Loop control structure048

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

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

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



Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...