fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static void Main()
  6. {
  7. Draw(6);
  8. }
  9.  
  10. private static void Draw(int width)
  11. {
  12. int numOfS = 1;
  13. string temp = "";
  14. int numOfH = width-1;
  15. int t1, t2;
  16. int i = 0;
  17. while (i < width)
  18. {
  19. t1 = numOfS;
  20. t2 = numOfH;
  21. while (t1 > 0)
  22. {
  23. temp += "*";
  24. t1--;
  25. }
  26. while (t2 > 0)
  27. {
  28. temp += "#";
  29. t2--;
  30. }
  31. Console.WriteLine(temp);
  32. numOfH--;
  33. numOfS++;
  34. temp = "";
  35. i ++;
  36. }
  37. }
  38. }
Success #stdin #stdout 0.02s 33776KB
stdin
Standard input is empty
stdout
*#####
**####
***###
****##
*****#
******