Last active
April 4, 2019 19:04
-
-
Save anonur/1da752a84b798cd1bc4bbc12ce514f5f to your computer and use it in GitHub Desktop.
Simple code for finding a factorial
This file contains hidden or 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
#include<stdio.h> | |
int main() | |
{ | |
int n; | |
int fact = 1; | |
printf("Enter an integer that you want to take the factorial of: "); | |
scanf("%d",&n); | |
while(n != 0) { | |
printf("%d\n",n); | |
fact = fact * n; | |
n --; | |
} | |
printf("%d",fact); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment