29 lines
760 B
C#
29 lines
760 B
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace primtenyezo
|
|||
|
{
|
|||
|
class Program
|
|||
|
{
|
|||
|
static void Main(string[] args)
|
|||
|
{
|
|||
|
Console.WriteLine("Prímtényezős felbontás");
|
|||
|
Console.Write("Pozitív egész szám: ");
|
|||
|
int szam = Convert.ToInt32(Console.ReadLine());
|
|||
|
int oszto = 2;
|
|||
|
while (szam > 1) {
|
|||
|
while (szam % oszto == 0) {
|
|||
|
Console.WriteLine("{0}\t | \t{1}", szam, oszto);
|
|||
|
szam = szam / oszto;
|
|||
|
}
|
|||
|
oszto++;
|
|||
|
}
|
|||
|
Console.WriteLine("{0} \t |", szam);
|
|||
|
Console.ReadKey();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|