 Write a C program to print right triangle pattern of multiplication table.
Required Knowledge
Algorithm to print triangle pattern of multiplication table
This program is similar to right triangle star pattern.
This program is similar to right triangle star pattern.
 Take the number of rows(N) of right triangle as input from user using scanf function.
 Number of integers in K^{th} row is always K.
 In any row R, we will print multiplication table of R1. Multiplication factor will start from 0 and continue till R1. For Example, 4^{th} row will print multiplication table of 3 till 4 terms and from factor 0 to 3.
Here is the matrix representation of the above mentioned pattern. The row numbers are represented by i whereas column numbers are represented by j.
C program to print multiplication table pyramid pattern
#include<stdio.h> int main() { int i, j, rows; int count = 1; printf("Enter the number of rows\n"); scanf("%d", &rows); for (i = 0; i < rows; i++) { for (j = 0; j <= i; j++) { printf("%d ", i*j); } printf("\n"); } return(0); }Output
Enter the number of rows 6 0 0 1 0 2 4 0 3 6 9 0 4 8 12 16 0 5 10 15 20 25
Related Topics
