You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
319 B

5 years ago
  1. #include "c2logic/builtins.h"
  2. extern struct MindustryObject message1;
  3. double factorial(int x) {
  4. if (x < 2) {
  5. return 1;
  6. }
  7. int ret = 1;
  8. for (int i = 2; i <= x; i++) {
  9. ret *= i;
  10. }
  11. return ret;
  12. }
  13. void main(void) {
  14. for (int i = 0; i < 10; i++) {
  15. printd(factorial(i));
  16. print("\n");
  17. }
  18. printflush(message1);
  19. }