public class test81
{
public static void main(String srgs[])
{
System.out.print("DO…WHILE语句输出1!+1/2!+1/3!……前20项之和");
int a=1;int s=1;double d=0;
do
{
s=a*s;d=1.0/s+d;a++;
}
while (a<=20);
System.out.print(d);
}
}
JAVA课程3 DO…WHLIE语句输出1!+1/2!+1/3!前20项目之和
最新推荐文章于 2024-01-09 11:30:31 发布