Skip to content

Instantly share code, notes, and snippets.

@Xmerr
Created December 5, 2016 13:22
Show Gist options
  • Save Xmerr/9d2f1e0ffc4a400e38b2fb57cc41c5cc to your computer and use it in GitHub Desktop.
Save Xmerr/9d2f1e0ffc4a400e38b2fb57cc41c5cc to your computer and use it in GitHub Desktop.
For Reddit Easy Challenge 286
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();
}
}
}
@Xmerr
Copy link
Author

Xmerr commented Dec 5, 2016

For Reddit Easy Challenge 286

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment