Advertisement
tegusta

rombo di *

Oct 9th, 2012
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. void rombo(int h){
  2. int k=h/2;
  3. for(int i=0;i<k;i++){
  4. for(int j=0;j<h;j++){
  5. if(j>=k-i && j<=k+i)
  6. cout<<"*";
  7. else
  8. cout<<" ";}
  9. cout<<"\n";}
  10. for(int i=0;i<h;i++)
  11. cout<<"*";
  12. cout<<"\n";
  13. for(int i=k-1;i>-1;i--){
  14. for(int j=h-1;j>-1;j--){
  15. if(j>=k-i && j<=k+i)
  16. cout<<"*";
  17. else
  18. cout<<" ";}
  19. cout<<"\n";}
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement