Thursday, 20 September 2012

pattern

Consider the pattern
*
**
***
****
*****..



#include<stdio.h>
 
main()
{
    int n, c, k;
 
    printf("Enter number of rows\n");
    scanf("%d",&n);
 
    for ( c = 1 ; c <= n ; c++ )
    {
        for( k = 1 ; k <= c ; k++ )
            printf("*");
 
        printf("\n");
    }
 
    return 0;
}

No comments:

Post a Comment