pascal triangle

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> using namespace std; int main() { int n, x, y, c, q; cout<<"Pascal Triangle Program\n"; cout<<"Enter the number of rows: "; cin>>n; cout<<endl; for (y = 0; y < n; y++) { c = 1; for(q = 0; q < n - y; q++) { cout<<" "; } for (x = 0; x <= y; x++) { cout<<" "<<c; c = c * (y - x) / (x + 1); } cout<<"\n"; } cout<<"\n"; return 0; }
Editor Settings
Theme
Key bindings
Full width
Lines