Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
A_04 SIMPSON'S RULE (3(II))
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
Program Simpsons_rule Implicit none Real::a=1.4,b=2.0,c=1.0,d=1.5,h,x,j1,j2,j3,k1,k2,k3,hx,y,q Real::l,w,f Integer::i,n=50,m=50,j h=(b-a)/n j1=0 j2=0 j3=0 Do i=0,n x=a+i*h hx=(d-c)/m k1=f(x,c)+f(x,d) k2=0 k3=0 Do j=1,m-1 y=c+j*hx q=f(x,y) If(mod(j,2)==0)then k2=k2+q else k3=k3+q End if End do l=(k1+2*k2+4*k3)*(hx/3) If(i==0.or.i==n)then j1=j1+l else if(mod(i,2)==0)then j2=j2+l else j3=j3+l End if End do w=h*(j1+2*j2+4*j3)/3 Print*,w End program Real function f(x,y) Implicit none Real::x,y f=alog(x+2*y) End function
Show compiler warnings
[
+
]
Show input
Compilation time: 0.12 sec, absolute running time: 0.15 sec, cpu time: 0.01 sec, memory peak: 5 Mb, absolute service time: 0,42 sec
edit mode
|
history
|
discussion
0.429554582