Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Fortran/exercise1/calc_pi.f90
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
program calc_pi
use iso_fortran_env
implicit none

integer, parameter :: num_samples = 1000000 ! Number of random samples

real :: x, y
real :: pi_approx
real(real64) :: x, y
real(real64) :: pi_approx
integer :: i, count_inside_circle

count_inside_circle = 0
Expand All @@ -14,7 +15,7 @@ program calc_pi
call random_number(x)
call random_number(y)

if (x**2 + x**2 <= 1.0) then
if (x**2 + y**2 <= 1.0) then
count_inside_circle = count_inside_circle + 1
end if
end do
Expand Down