Write a program to print Factorial of any number
Anonymous:
In HTML code or c++ language bro?
Answers
Answered by
1
★彡 Here is Your Answer 彡★
<?php
$number = 6; /*number to get factorial */
$fact = 1;
for($k=1;$k<=$number;++$k)
{
$fact = $fact*$k;
}
echo "Factorial of $number is ".$fact;
?>
Ehsass ★
Answered by
3
Explanation:
Factorial program in C using a for loop
- #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;
Mark as Brainlist
Similar questions