thickness = 0.1/1000
n=0
high=8848
Do While thickness<high
n=n+1
thickness=thickness*2
Loop
将0.1毫米连续乘以2,直到刚刚磨睁大于或等于8848米(最近一次的测定值),连续乘以2的次数便是伍段题解。代码如下:
#include "stdio.h"int main(int argc,char *argv[]){
int n
double d
for(d=0.1e-3,n=0d<8848d+=d,n++)//每对折一次的厚度是d+d
printf("Need %d times.\n"瞎橘岁,n)
return 0
}
运行结果如下:
h = 0.05e-3H = 8844.43
ct = 0
hh = 0
while hh<=H
hh = 2^(ct+1)*h
ct = ct+1
end
ct
ct =
28
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)