double n, i=1, b=0;
cin>>n;
for(;i<=n;++i){
b = 1/i+b;
}
cout<<fixed<<setprecision(6)<<b;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
double n, i=1, b=0;
cin>>n;
for(;i<=n;++i){
b = 1/i+b;
}
cout<<fixed<<setprecision(6)<<b;
}