Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n;
- cout<<"enter the n: ";
- cin>>n;
- int up=(n+1)/2;
- for(int i=up;i>=1;i--)
- {
- int spaces=2*(up-i);
- for(int j=1;j<=spaces;j++)
- {
- cout<<" ";
- }
- int chars=2*(i-1)+1;
- for(int k=1;k<=chars;k++)
- {
- cout<<"* ";
- }
- cout<<endl;
- }
- for(int i=2;i<=up;i++)
- {
- int spaces=2*(up-i);
- for(int j=1;j<=spaces;j++)
- {
- cout<<" ";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement