Skip to content

Instantly share code, notes, and snippets.

@dzsquared
Created December 30, 2016 02:45
Show Gist options
  • Save dzsquared/68bcfd9f2899acd2aa7d902f98989180 to your computer and use it in GitHub Desktop.
Save dzsquared/68bcfd9f2899acd2aa7d902f98989180 to your computer and use it in GitHub Desktop.
using System;
using System.Collections.Generic;
using System.IO;
class Solution {
static int factorial(int thenumber) {
if(thenumber <= 1) {
return 1;
} else {
return thenumber * factorial(thenumber-1);
}
}
static void Main(String[] args) {
int wheretostart = Convert.ToInt32(Console.ReadLine());
int theresponse = factorial(wheretostart);
Console.WriteLine(theresponse);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment