C Program to Print Half Pyramid of Numbers

In this program, you'll learn to print half pyramid of numbers.



Source Code
#include <stdio.h>
#include <conio.h>
void main()
{
    int i,j;
    clrscr();
    for (i=0; i<5; i++)
    {
        for (j=0; j<=i; j++)
        {
            printf("%d ", i+1);
        }
        printf("\n");
    }
    getch ( );
}
Output
1
2 2
3 3 3
4 4 4 4
5 5 5 5 5