Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Program
- {
- static void MakeTable(int n)
- {
- Console.WriteLine("-----------------------------------------------");
- Console.Write($"| №{1,-4} | ");
- Console.Write($"{ 1,-20}|");
- Console.WriteLine(" кратно ли 5 |");
- Console.WriteLine("-----------------------------------------------");
- for (int start = 2; start <= n; start++)
- {
- if (start * start * start % 5 == 0)
- {
- Console.Write($"| №{ start,-4} | ");
- Console.Write($"{start * start * start,-20}|");
- Console.WriteLine(" кратно |");
- Console.WriteLine("-----------------------------------------------");
- }
- else
- {
- Console.Write($"| №{start,-4} | ");
- Console.Write($"{start * start * start,-20}|");
- Console.WriteLine(" не кратно 5 |");
- Console.WriteLine("-----------------------------------------------");
- }
- }
- }
- }
- static void Main(string[] args)
- {
- Console.WriteLine("введите ваше число");
- int n = int.Parse(Console.ReadLine());
- MakeTable(n);
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement