[ create a new paste ] login | about

Link: http://codepad.org/OzSxEo7r    [ raw code | output | fork ]

C, pasted on Aug 28:
#include<stdio.h>
 
main()
{
    int n=4, c, k, space, count = 1;
 
    space = n;
 
    for ( c = 1 ; c <= n ; c++)
    {
        for( k = 1 ; k < space ; k++)
           printf(" ");
 
        for ( k = 1 ; k <= c ; k++)
        {
            printf("*");
 
            if ( c > 1 && count < c)
            {
                 printf("A");    
                 count++; 
            }      
        }    
 
        printf("\n");
        space--;
        count = 1;
    }
    return 0;
}


Output:
1
2
3
4
   *
  *A*
 *A*A*
*A*A*A*


Create a new paste based on this one


Comments: