Source Code:
#include <stdio.h>
int main() {
int rows, a, b, number = 1;
printf("Number of rows to print:");
scanf("%d",&rows);
for ( a = 1 ; a <= rows ; a++ ) {
for ( b = 1 ; b <= a ; b++ ) {
printf("%d ", number);
number++;
}
printf("\n");
}
}
Output is as:
No comments:
Post a Comment