Header Ads

Right-angled triangle printing in C

Right-angle Triangle: - A triangle whose hypotenuse is equal to the square root of sum of square of base and height of the same triangle.

Program


#include<stdio.h>
#include<conio.h>
main()
{
            int row,count,col;
            printf("Enter the number of rows  you want to print:");
            scanf("%d",&row);
            for(count=1;count<=row;count++)
            {
                       
                        for(col=1;col<=count;col++)
                        {
                        printf("%d ",col);        
                        }
                        printf("\n");
            }
            getch();
}

Output

Enter the number of rows  you want to print: 5
1
1  2
1  2  3
1  2  3  4
1   2   3   4   5



No comments