-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
104 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
program empty | ||
end program |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function func(i) result(j) | ||
integer, intent (in) :: i ! input | ||
integer :: j ! output | ||
|
||
j = i**2 + i**3 | ||
end function | ||
|
||
subroutine square_cube(i, isquare, icube) | ||
integer, intent (in) :: i ! input | ||
integer, intent (out) :: isquare, icube ! output | ||
|
||
isquare = i**2 | ||
icube = i**3 | ||
end subroutine | ||
|
||
subroutine hello | ||
print *, "Hello world" | ||
end subroutine | ||
|
||
program main | ||
implicit none | ||
external square_cube ! external subroutine | ||
integer :: isq, icub | ||
integer :: i | ||
integer :: func | ||
|
||
call square_cube(4, isq, icub) | ||
print *, "i,i^2,i^3=", 4, isq, icub | ||
|
||
i = 3 | ||
print *, "sum of the square and cube of", i, "is", func(i) | ||
end program | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
end |