Horje
Pascal triangle using c++ Code Example
Pascal triangle using c++
#include <iostream>
using namespace std;


int fact(int num){
    int factorial = 1;
    for (int i = 2; i <= num; i++)
    {
        factorial = factorial * i;
    }
    return factorial;
}

int main(){
    int n;
    cout << "Enter number of rows: ";
    cin >> n;

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j <=i; j++)
        {
            cout << fact(i) / (fact(j) * fact(i - j)) << " ";
        }
        cout << endl;
    }
    
}




Cpp

Related
c++ progress bar Code Example c++ progress bar Code Example
copy 2 dimensional array c++ Code Example copy 2 dimensional array c++ Code Example
sleep system function linux c++ Code Example sleep system function linux c++ Code Example
checking if a string has only letters cpp Code Example checking if a string has only letters cpp Code Example
fast i/o in c++ Code Example fast i/o in c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9