lancidie

一 lua

 

function Fact(n)
    
if(n < 0then
        
return 0
    
end
    
    
if(n == 0then
        
return 1
    
else
        
return n * Fact(n-1)
    
end
end

 

二 C++

 

int Fact(int n)
{
    
if (n < 0)
    {
        
return 0;
    }

    
if (n == 0)
    {
        
return 1;
    }
    
else
    {
        
return n * Fact(n-1);
    }
}

 

 

分类:

技术点:

相关文章:

  • 2021-11-17
  • 2022-12-23
  • 2021-06-05
  • 2022-12-23
  • 2021-06-10
  • 2021-09-08
  • 2021-11-17
  • 2021-11-17
猜你喜欢
  • 2021-11-17
  • 2021-11-17
  • 2021-08-20
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
  • 2021-11-17
相关资源
相似解决方案