Created
December 5, 2016 13:22
-
-
Save Xmerr/9d2f1e0ffc4a400e38b2fb57cc41c5cc to your computer and use it in GitHub Desktop.
For Reddit Easy Challenge 286
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace Reverse_Factorial | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Console.WriteLine("Enter Number: "); | |
int input = Convert.ToInt32(Console.ReadLine()); | |
int i = 2; | |
Console.Clear(); | |
Console.Write(input + " = "); | |
while(input > 1 && input % i == 0) | |
{ | |
input = input / i; | |
i++; | |
} | |
if (input == 1) | |
Console.Write((i-1) + "!\n"); | |
else | |
Console.Write("Not a Factorial\n"); | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For Reddit Easy Challenge 286