+ 2

Write a c++ program to 1/2+ 2/3+3/4+5/6...........99/100 using for loop

24th Apr 2018, 5:29 PM
olotu olusola
olotu olusola - avatar
2 Answers
+ 2
thank you boss
24th Apr 2018, 7:44 PM
olotu olusola
olotu olusola - avatar
+ 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)]))
24th Apr 2018, 6:01 PM
Louis
Louis - avatar