阶乘-n!_C语言实现

n!

// Code file created by C Code Develop

#include "stdio.h"
#include "stdlib.h"


int main(){
    int fac(int c);
    printf("%d", fac(- 4));
    
    return 0;
}

int fac(int n) {
    if(n < 0) return EOF;
    if(n == 0 || n == 1) return 1;
    
    return n*fac(n - 1);
}

 

posted @ 2021-11-23 16:30  def_Class  阅读(72)  评论(0编辑  收藏  举报