fork(1) download
  1. import 'dart:io';
  2.  
  3. void main() {
  4. int n = 5;
  5. if(n%2 == 0){
  6. return;
  7. }
  8.  
  9. int row = 3*n;
  10. int col = 2 *n;
  11. int spaceBefore = 1;
  12. int spaceAfter = 2*n-1;
  13. int rowmid = ((row-1)/2).round();
  14. int spaceBefore2 = n-1;
  15. int spaceAfter2 = n;
  16. int mid = 1;
  17.  
  18.  
  19. for(int i = 1; i<=row; i++){
  20. if(i<n){
  21. print("*"*spaceBefore + " "*spaceAfter);
  22. }else if(i==n){
  23. print("*"*n+ " "*n);
  24. }else if(i>n && i<rowmid){
  25. print(" "* spaceBefore2 + "*"*mid + " "*spaceAfter2);
  26. }
  27.  
  28.  
  29. }
  30.  
  31.  
  32.  
  33. }
Success #stdin #stdout 1.18s 130448KB
stdin
Standard input is empty
stdout
*         
*         
*         
*         
*****     
    *