+ 2
Write a c++ program to 1/2+ 2/3+3/4+5/6...........99/100 using for loop
2 Answers
+ 2
thank you boss
+ 1
#include <iostream>
using namespace std;
int main() {
float out=0;
for(float i=1;i<=99;i++){
out=out+i/(i+1);
}
cout<<out;
}
and now that I've done it in C++ I just have to show why I love Python.
print(sum([i/(i+1) for i in range(1,100)]))