Advertisement
Slavik9510

Untitled

Dec 4th, 2022
394
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.43 KB | None | 0 0
  1. using System;
  2. class Program {
  3.   static void Main() {
  4.      int n, div = 2;
  5.      bool isFirst = true;
  6.    Console.Write("Введіть число: ");
  7.   n = int.Parse(Console.ReadLine());
  8.   while (n > 1)
  9.   {
  10.     while (n % div == 0)
  11.     {
  12.         if(!isFirst)
  13.         {
  14.             Console.Write($"* ");
  15.         }
  16.         isFirst = false;
  17.       Console.Write($"{div} ");
  18.       n = n / div;
  19.     }
  20.     div++;
  21.   }
  22.   }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement