小编Pro*_*Mad的帖子

为什么我不能通过C代码制作这个系列

我试着在C:
系列中写下面的系列:(1^1),(2^(1/2)),(6^(1/4)),(24^(1/8)),...,((n!)^((1/2)^n)).

C代码:

#include <stdio.h>
#include <math.h>


int fact(int x){
  if (x==1)
    return 1;
    else return x*fact(x-1);
}


int main(){
    int x,y;
    scanf("%d",&x);
    y=x;
    x=fact(x);
    y=pow(0.5,y-1);
    double h;
    h=pow(x,y);
    printf("\n%lf" ,h);
    return 0;
}
Run Code Online (Sandbox Code Playgroud)

为什么一直打印1.00000

c series

1
推荐指数
1
解决办法
119
查看次数

标签 统计

c ×1

series ×1