n =input("输入一个数:")
n =int(n)
sum =1/n
x =2
y =1
while x < n:
if n %2 ==0:
sum = sum + (1/x)
x+=1
print(sum)
break
elif n %2 !=0:
sum = sum + (1/y)
y +=1
print(sum)
break
n =input("输入一个数:")
n =int(n)
sum =1/n
x =2
y =1
while x < n:
if n %2 ==0:
sum = sum + (1/x)
x+=1
print(sum)
break
elif n %2 !=0:
sum = sum + (1/y)
y +=1
print(sum)
break
本文标题:2018-07-04
本文链接:https://www.haomeiwen.com/subject/tohyuftx.html
网友评论