Advertisement
Guest User

Untitled

a guest
Feb 29th, 2020
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.41 KB | None | 0 0
  1. class Program
  2. {
  3. static void MakeTable(int n)
  4. {
  5. Console.WriteLine("-----------------------------------------------");
  6. Console.Write($"| №{1,-4} | ");
  7. Console.Write($"{ 1,-20}|");
  8. Console.WriteLine(" кратно ли 5 |");
  9. Console.WriteLine("-----------------------------------------------");
  10.  
  11. for (int start = 2; start <= n; start++)
  12. {
  13. if (start * start * start % 5 == 0)
  14. {
  15. Console.Write($"| №{ start,-4} | ");
  16. Console.Write($"{start * start * start,-20}|");
  17. Console.WriteLine(" кратно |");
  18. Console.WriteLine("-----------------------------------------------");
  19. }
  20. else
  21. {
  22. Console.Write($"| №{start,-4} | ");
  23. Console.Write($"{start * start * start,-20}|");
  24. Console.WriteLine(" не кратно 5 |");
  25. Console.WriteLine("-----------------------------------------------");
  26. }
  27. }
  28. }
  29. }
  30. static void Main(string[] args)
  31. {
  32. Console.WriteLine("введите ваше число");
  33. int n = int.Parse(Console.ReadLine());
  34. MakeTable(n);
  35. Console.ReadKey();
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement