How to create pattern of 1-10 in a triangle?

CODE




How to create pattern of 1-10 in a triangle?
int main()
{
    int i,j,a=1;
    for(i=1;i<=4;i++)
    {
        for(j=1;j<=i;j++)
        {
            printf("%d ",a);
            a++;
        }
        printf("\n");
    }
}

Output:

1
2  3
4  5  6
7  8  9  10


How to create pattern of 1-10 in a triangle? How to create pattern of 1-10 in a triangle? Reviewed by Unknown on December 16, 2018 Rating: 5

No comments:

If you have any doubt or query ,comment below:

Programming copyright © 2018-19. Powered by Blogger.