© 2014 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies

CPP Program To Print Diamond Shape In Screen
#include #include void main() { int i,j,k; clrscr(); for(i=1;i<=15;i++) { for(j=i;j<15;j++) cout<<" "; k=2*i-1; while(k>=1) { cout<<"*"; k--; } cout<<"\n"; } for(i=14;i>=1;i--){ for(j=i;j<15;j++) cout<<" "; k=2*i-1; while(k>=1) { cout<<"*"; k--; } cout<<"\n"; } getch(); }

Sample Output :

                    *
                  ***
                *****
             ********
          ***********
        *************
       ***************
      *****************
     *******************
    *********************
   ***********************
  *************************
 ***************************
*****************************
 ***************************
  *************************
   ***********************
    *********************
     *******************
      *****************
       ***************
        *************
         ***********
          *********
           *******
            *****
             ***
               *

 

 
SLogix Student Projects


⇓Student Projects⇓
⇑Student Projects⇑
bottom