import mathdef func(x): return x*math.sin(x/2) a = 0b = 3.1415926s = 0n = 10000h = (b-a)/nfor i in range(n): s += func(a+h*(i-1))print(s*h)
Standard input is empty
3.998519497981442
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!