Half pyramid using numbers in C programming
Contents
hide
In this program, we will see the half pyramid using numbers in C programming language.
1 1 2 1 2 3 1 2 3 4 1 2 3 4 5 1 2 3 4 5 6
The C program for above half pyramid using numbers is as follows:
#include <stdio.h> int main() { int no_rows, i, j; printf("Please enter the number of rows = "); scanf("%d",&no_rows); for(i=1; i<=no_rows; i++) { for(j=1; j<=i; j++) { printf("%d ",j); } printf("n"); } getch(); return 0; }