Assignment: Write a complete MIPS program that implements the algorithm below (in C ). This algorithm calculates the factorial for the value of m. You should setup "m" as a variable in your program so that it is easy to change this value and rerun the program to get a different result. In case you are unsure of what a factorial is, it is the multiplication of an integer with all integers from 1 to that integer. One special case is the the value of zero factorial is 1. So, for 5 factorial (written as 5!), the value is 5*4*3*2*1

Respuesta :

Explanation:

There are various basic computer programming languages and one of them is the C language, the base of many computer lanuages.

The code of finding factorial is written below;

CODE

#include<stdio.h>

int main (void)

{

    int i,

   int factorial =1,

   int input;

   printf("Enter a number for finding its factorial: ");

    scanf("%d",&input);

   if (input == 0)

factorial = 0

 eles

    for ( i =1; I < = input ;i++)

        factorial = factorial*i;

   

    printf("Factorial of given %d is: %d",input,factorial);

    return 0;

  }