Skip to content

factorial of a number using c#7

Open
ghost wants to merge 2 commits intoKanwarPrince:masterfrom
aliyaashraf:master
Open

factorial of a number using c#7
ghost wants to merge 2 commits intoKanwarPrince:masterfrom
aliyaashraf:master

Conversation

@ghost
Copy link

@ghost ghost commented Oct 31, 2019

#include <stdio.h>

int main()
{
int c, n, fact = 1;

printf("Enter a number to calculate its factorial\n");
scanf("%d", &n);

for (c = 1; c <= n; c++)
fact = fact * c;

printf("Factorial of %d = %d\n", n, fact);

return 0;
}

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant