mirror of
https://github.com/Minres/RISCV-VP.git
synced 2025-12-17 17:01:35 +00:00
25 lines
368 B
C
25 lines
368 B
C
#include <stdint.h>
|
|
#include <stdio.h>
|
|
#include <unistd.h>
|
|
|
|
#include <platform.h>
|
|
#include "encoding.h"
|
|
|
|
int factorial(int i){
|
|
|
|
volatile int result = 1;
|
|
for (int ii = 1; ii <= i; ii++) {
|
|
result = result * ii;
|
|
}
|
|
return result;
|
|
|
|
}
|
|
|
|
int main()
|
|
{
|
|
volatile int result = factorial (10);
|
|
printf("Factorial is %d\n", result);
|
|
printf("End of execution");
|
|
return 0;
|
|
}
|