forked from Firmware/Firmwares
33 lines
646 B
C
33 lines
646 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()
|
|
{
|
|
FILE * out = fdopen(STDOUT_FILENO, "w");
|
|
int value=0;
|
|
int res = read(STDIN_FILENO, &value, 1);
|
|
// FILE * inp = fdopen(STDIN_FILENO, "r");
|
|
//fprintf(out, "hello world!\n");
|
|
// int value = 0;
|
|
// int res = fscanf(inp, "%d", value);
|
|
// int res = scanf("%d", value);
|
|
volatile int result = factorial (10);
|
|
fprintf(out, "Factorial is %d\n", result);
|
|
printf("End of execution");
|
|
return 0;
|
|
}
|