编程题 s=1+1/2+1/3+1/4+...+1/n

日期:2016-04-19 19:50:19 人气:1

编程题 s=1+1/2+1/3+1/4+...+1/n

#include using namespace std; void main() { int i,n; double s=0; cout<<"请输入一个正整数 :"; cin>>n; for(i=1;i<=n;i++) { s=s+1.0/i; } cout<<s<<endl; } 不给财富值,愿意帮你做题的人真不多
    A+
热门评论