fork(1) download
  1. using System;
  2.  
  3. namespace ConsoleApp1
  4. {
  5. class program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int x = 0;
  10. int y = 0;
  11. int z = 0;
  12.  
  13. Console.WriteLine("1から20までの数字を入力");
  14. x = int.Parse(Console.ReadLine());
  15.  
  16. if(x > 0 && x <= 20)
  17. {
  18. for (y = 1; y <= x; y++)
  19. {
  20. for (z = 1; z <= y; z++)
  21. {
  22. Console.Write("*");
  23. }
  24. Console.WriteLine("");
  25. }
  26. }
  27. else
  28. {
  29. Console.WriteLine("エラーです");
  30. }
  31.  
  32.  
  33. }
  34. }
  35. }
  36.  
Success #stdin #stdout 0.02s 16172KB
stdin
18
stdout
1から20までの数字を入力
*
**
***
****
*****
******
*******
********
*********
**********
***********
************
*************
**************
***************
****************
*****************
******************