Monday 20 August 2012

Loop control structure045

Write a program to construct  the image shown below.
                        100000000
                        010000000
                        001000000
                        000100000
                        000010000
                        000001000
                        000000100
                        000000010
                        000000001

#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 = 1; j <= 9; j++ )
                           {                                    
                                           if ( i == j )
                                                    printf ( " 1");
                                           else               
                                                    printf ( " 0");
                           }
                           printf ("\n\t\t\t  ");
           }
           getch ( );
}



Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...