Saturday, April 13, 2019

Program to find FACTORIAL OF A NUMBER in Language C

WELCOME BACK CODERS, hope you are enjoying our blogs

have a good day.


IN THIS PROGRAM THE USER NEEDS TO INPUT A NUMBER AND ITS FACTORIAL WILL BE PRINTED.


CODE


#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("\n Factorial=%d ",fact);
return 0;
}


OUTPUT



No comments:

Post a Comment

PUBG MOBILE FIRST ANNIVERSARY EVENT FEATURES A NEW SONG FROM ALAN WALKER

PUBG MOBILE to Feature Alan Walker’s New Single “On My Way “and Host One of the World’s Biggest Mobile Gaming Tournament In celebratio...