viewing paste Unknown #17480 | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
//Diamond
 
#include<stdio.h>
#include<stdlib.h>
 
#define TOTAL_ROWS 15
int main(void){
    int row,col,numstars=1,//A[15][15];
    int half,rate=1;
    
    //Loop through each row
    for(row=1;row<=TOTAL_ROWS;row++){
        half= TOTAL_ROWS/2;
        
    
      }
    //for(col=1;col<15;col++)A[row][1]=' ';
    
        
        
        //draw blanks before stars
    for(col=0;col<=half + 1 -numstars;col++){
        printf(" ");
         
        }
        //Draw Stars
        for(col=1;col<=2*numstars - 1;col++)
        //if (col=4)
        //  printf("&");
        
        //else
            printf("*");
        
        
        //Middle of Diamond
        if((numstars==(half+1)))
          rate=-rate;
          
          //change numstars by rate
        numstars=numstars+rate;
        
        //New line
        printf("\n");
        
    
    
        
        
    
     
    system("pause");
    return 0;
    }
Viewed 558 times, submitted by Guest.