Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SILAHKAN COMOT GANN
- #include <iostream>
- using namespace std;
- int main()
- {
- int baris, koef = 1;
- cout << "Masukan banyak baris: ";
- cin >> baris;
- for(int i = 0; i < baris; i++)
- {
- for(int spasi = 1; spasi <= baris-i; spasi++){
- cout <<" ";
- }
- for(int j = 0; j <= i; j++)
- {
- if (j == 0 || i == 0){
- koef = 1;
- }
- else{
- koef = koef*(i-j+1)/j;
- }
- cout << koef << " ";
- }
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement