Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace PrimeFactors
- {
- class Program
- {
- static void Main(string[] args)
- {
- int num = int.Parse(Console.ReadLine());
- while (num % 2 == 0)
- {
- num /= 2;
- Console.WriteLine("2");
- }
- while (num % 3 == 0)
- {
- num /= 3;
- Console.WriteLine("3");
- }
- while (num % 5 == 0)
- {
- num /= 5;
- Console.WriteLine("5");
- }
- while (num % 7 == 0)
- {
- num /= 7;
- Console.WriteLine("7");
- }
- while (num%11==0)
- {
- num /= 11;
- Console.WriteLine("11");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment