Search⌘ K

Example 40: Pascal's Triangle

Explore how to generate Pascal's triangle in C by implementing functions for modular computation like factorial, and using nested loops to print the triangle pattern. Understand the logic and improve your problem-solving skills with functions.

We'll cover the following...

Problem

Write a program to generate Pascal’s triangle pattern shown below:

11

1   11 \space\space \space 1

1   2   11 \space \space\space 2 \space \space\space 1 ...