Thursday 16 August 2012

Loop control structure030

Write a program to construct  hollow square box of star.

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

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


        printf ("\n\t\t\t   Designee of holo Square Box");
        printf ("\n\n\n");
                         
        for ( i = 1; i <= 16; i++ )
        {                     
                        for ( k =1; k <=30; k++ )
                        {                    
                                        printf (" ");
                        }                                                                   
                        for ( j = 1; j <= 16; j++ )
                        {                            
                                        if ( i == 1 || i == 16 || j == 1 || j == 16 )
                                                                printf ("*");
                                        else                                 
                                                                printf (" ");
                        }
                        printf ("\n");
        }   
        getch ( );
}



Click here to contact us

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...