Skip to content

Instantly share code, notes, and snippets.

@axayjha
Created August 25, 2017 18:29
Show Gist options
  • Save axayjha/117a74b1f2af59b419ba77edf711edd9 to your computer and use it in GitHub Desktop.
Save axayjha/117a74b1f2af59b419ba77edf711edd9 to your computer and use it in GitHub Desktop.
#include <stdio.h>
int fact(int n)
{
if(n<=1) return 1;
else return n*fact(n-1);
}
int main()
{
int n;
scanf("%d", &n);
for(int i=1; fact(i)<=n; i++)
{
printf("%d ", fact(i));
}
printf("\n");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment