Advertisement
asdfg0998

Untitled

Jan 19th, 2023
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main(){
  4. int len;
  5. cin>>len;
  6. // har len ko even bna ke
  7. int n=(len+1)/2;
  8. for(int i=1;i<=n;i++){
  9. for(int j=1;j<=i;j++){
  10. cout<<"*";
  11. }
  12. for(int j=1;j<=2*n - 2*i;j++){
  13. cout<<" ";
  14. }
  15. for(int j=1;j<=i;j++){
  16. cout<<"*";
  17. }
  18. cout<<endl;
  19.  
  20. }
  21. for(int i=n-1;i>=1;i--){
  22. for(int j=1;j<=i;j++){
  23. cout<<"*";
  24. }
  25. for(int j=1;j<=2*n - 2*i;j++){
  26. cout<<" ";
  27. }
  28. for(int j=1;j<=i;j++){
  29. cout<<"*";
  30. }
  31. cout<<endl;
  32.  
  33. }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement