Floyd Triangle

 #include <stdio.h>

int main() {
    int rows;
    int n=1;
    printf("Enter the no. of rows: ");
    scanf("%d",&rows);
    for (int i=1;i<=rows;i++){
        for (int j=1;j<=i;j++){
            printf("%d ",n);
            n++;
        }
        printf("\n");
    }
    return 0;
}
Enter the no. of rows: 5 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Comments

Popular posts from this blog

Transpose

1 to n without any parameter Recursion

Recursion Factorial