今天学习了如何计算每天取其一半绳子的第n天长度
#include <stdio.h>
#include <math.h>
int main()
{
int b;
float a;
printf("Input length and days:");
scanf("%f,%d",&a,&b);
float c=a/(pow(2,b));
printf("length=%.5f\n",c);
return 0;
}
例如长为12,第五天绳的长度
运行结果如下:
Input length and days:12,5
length=0.37500
--------------------------------
Process exited after 2.927 seconds with return value 0
请按任意键继续. . .