Created
April 25, 2020 14:43
-
-
Save m-primo/3ebab1a65c34d7d5c882e39c2ecb1842 to your computer and use it in GitHub Desktop.
pascal triangle c++
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int a, b; | |
int main() { | |
cout << "A: "; | |
cin >> a; | |
cout << 1 << " " << endl; | |
for(int i = 0; i <= a; i++) { | |
b = 1; | |
for(int j = 0; j <= i; j++) { | |
cout << b << " "; | |
b = b * (i - j) / (j + 1); | |
} | |
cout << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment