i wrote a code for computing factorial on C, however im trying to translate it to assembly language to work on PCspim but have no idea how?? can someone help please?
C code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void factorial(long argument, long *result) {
if(argument < 2) {
printf("%ld", *result);
} else {
long before = argument - 1;
*result = *result * before;
argument = before;
factorial(argument, result);
}
}
int main() {
long argument, answer, *result;
printf("Factorial ");
scanf("%ld", &argument);
result = &answer;
*result = argument;
printf("%ld! = ",argument);
factorial(argument, result);
}