Add project files.
This commit is contained in:
28
primtenyezo/Program.cs
Normal file
28
primtenyezo/Program.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user