C Program to Print Right Pascals Triangle of Multiplication Numbers Pattern

Write a C program to print right pascals triangle of multiplication numbers pattern using for loop.

#include <stdio.h>

int main()
{
	int i, j, rows;

	printf("Enter Right Pascals Triangle Numeric Multiplication Rows = ");
	scanf("%d", &rows);

	printf("The Right Pascals Triangle of Numbers Multiplication Pattern\n");

	for (i = 1; i <= rows; i++)
	{
		for (j = 1; j <= i; j++)
		{
			printf("%d ", j * i );
		}
		printf("\n");
	}

	for (i = rows - 1; i >= 1; i--)
	{
		for (j = 1; j <= i; j++)
		{
			printf("%d ", j * i);
		}
		printf("\n");
	}
}
C Program to Print Right Pascals Triangle of Multiplication Numbers Pattern

This C program prints the right pascals triangle pattern of multiplication numbers using a while loop.

#include <stdio.h>

int main()
{
	int i, j, temp, rows;

	printf("Enter Right Pascals Triangle Numeric Multiplication Rows = ");
	scanf("%d", &rows);

	printf("The Right Pascals Triangle of Numbers Multiplication Pattern\n");
	temp = 1;

	for (i = 1; i <= rows / 2 + 1; i++, temp++)
	{
		for (j = 1; j <= i; j++)
		{
			printf("%d ", j * temp);
		}
		printf("\n");
	}

	for (i = 1; i <= rows / 2; i++, temp++)
	{
		for (j = 1; j <= rows / 2 - i + 1; j++)
		{
			printf("%d ", j * temp);
		}
		printf("\n");
	}
}
Enter Right Pascals Triangle Numeric Multiplication Rows = 9
The Right Pascals Triangle of Numbers Multiplication Pattern
1 
2 4 
3 6 9 
4 8 12 16 
5 10 15 20 25 
6 12 18 24 
7 14 21 
8 16 
9

This C example uses the do while loop to print the right pascals multiplication numbers triangle pattern.

#include <stdio.h>

int main()
{
	int rows, i, j, temp;

	printf("Enter Right Pascals Numbers Multiplication Triangle Rows = ");
	scanf("%d", &rows);

	printf("The Right Pascals Triangle of Numbers Multiplication Pattern\n");
	i = temp = 1;

	while (i <= rows / 2 + 1)
	{
		j = 1;
		while (j <= i)
		{
			printf("%d ", j * temp);
			j++;
		}

		printf("\n");
		temp++;
		i++;
	}

	i = 1;
	while (i <= rows / 2)
	{
		j = 1;
		while (j <= rows / 2 - i + 1)
		{
			printf("%d ", j * temp);
			j++;
		}

		printf("\n");
		temp++;
		i++;
	}
}
Enter Right Pascals Numbers Multiplication Triangle Rows = 15
The Right Pascals Triangle of Numbers Multiplication Pattern
1 
2 4 
3 6 9 
4 8 12 16 
5 10 15 20 25 
6 12 18 24 30 36 
7 14 21 28 35 42 49 
8 16 24 32 40 48 56 64 
9 18 27 36 45 54 63 
10 20 30 40 50 60 
11 22 33 44 55 
12 24 36 48 
13 26 39 
14 28 
15