C program to print right triangle pyramid pattern of multiplication tables

  • Write a C program to print right triangle pattern of multiplication table.

Here is a sample right triangle pattern of multiplication table.
Multiplication_Factor_Pattern

Required Knowledge

Algorithm to print triangle pattern of multiplication table

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 Kth row is always K.
  • In any row R, we will print multiplication table of R-1. Multiplication factor will start from 0 and continue till R-1. For Example, 4th 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.

Multiplication_Factor_Triangle_Pattern

C program to print multiplication table pyramid pattern

C program to print right triangle pyramid pattern of multiplication tables

#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