Friday, 27 January 2017

C++ -TO PRINT HOLLOW DIAMOND USING ASTERIKS IN C++

#include<iostream.h>
#include<math.h>
void amin()
{  
     int i=0,j=0,n=3;    //Here n=3 refers to the size of the diamond.You can input any other size
       for(i=-n  ;   i<=n  ;    i++)
          {
               for(j=-n  ;   j<=n  ;  j++)
                  {
                         if(  abs(i)  +   abs(j)   == n  )
                          cout<<"*"  ;
                         else
                            cout<<"    " ;
                   }
                cout<<" \ n"  ;
           }
}