ambiorixdr

Rhombus of Stars

Oct 15th, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace RomboidStars
  8. {
  9. class RomboidStarsMain
  10. {
  11. static void Main(string[] args)
  12. {
  13. int n = int.Parse(Console.ReadLine());
  14. for (int i = 1; i <= n; i++)
  15. {
  16. Console.Write(new string(' ', n - i)); // drawing the upper part using that n is static and i is increasing
  17. Console.Write('*');
  18. for (int j = 1; j < i; j++)
  19. {
  20. Console.Write(" *");
  21. }
  22. Console.WriteLine();
  23. }
  24. for (int i = 1; i < n; i++)
  25. {
  26. Console.Write(new string(' ', i)); //drawing the bottom part using that n is static and i is increasing
  27. Console.Write('*');
  28. for (int j = 1; j < n-i; j++)
  29. {
  30. Console.Write(" *");
  31. }
  32. Console.WriteLine();
  33. }
  34. }
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment