Tuesday, 10 January 2012

Print The Asterisks graph in C

#include<stdio.h>
#include<conio.h>

void main()
{
    int i,j,n;
    clrscr();
    printf("Enter the number of row::\n");
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    {
        for(j=0;j<i;j++)
        {
            printf("*");
        }
        printf("\n");
    }
    getch();
}


Output:
Enter the number of row::4
*
* *
* * *
* * * *

No comments:

Post a Comment