Advertisement
Guest User

Untitled

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