Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int** pascal(int n){
- int coef = 1;
- for(int i = 0; i < n; i++)
- {
- for(int space = 1; space <= n-i; space++)
- cout <<" ";
- for(int j = 0; j <= i; j++)
- {
- if (j == 0 || i == 0)
- coef = 1;
- else
- coef = coef*(i-j+1)/j;
- cout << coef << " ";
- }
- cout << endl;
- }
- return 0;
- }
- int main(){
- int rows;
- cout << "Enter number of rows: ";
- cin >> rows;
- pascal(rows);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement