Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<conio.h>
- using namespace std;
- int main()
- {
- int n, c, k, spasi=1;
- cout<<"Masukkan Dimensi Diamond : ";
- cin>>n;
- spasi=n-1;
- for (k=1; k<=n; k++)
- {
- for(c=1; c<=spasi; c++)
- {
- cout<<" ";
- }
- spasi--;
- for(c=1; c<=(2*k-1); c++)
- {
- cout<<"*";
- }
- cout<<"\n";
- }
- spasi=1;
- for(k=1; k<=(n-1); k++)
- {
- for(c=1; c<=spasi; c++)
- {
- cout<<" ";
- }
- spasi++;
- for(c=1 ; c<=(2*(n-k)-1); c++)
- {
- cout<<"*";
- }
- cout<<"\n";
- }
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment