Computer Science, asked by Anonymous, 9 months ago

Write a program to print Factorial of any number


Anonymous: In HTML code or c++ language bro?
EHSASS: PHP
Anonymous: Yes in PHP

Answers

Answered by EHSASS
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 ankitgupta82
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