-
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.
Modernize some of the fortran examples
- Loading branch information
Showing
3 changed files
with
36 additions
and
36 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
cc34567 Cubes program | ||
PROGRAM SUM_OF_CUBES | ||
INTEGER :: H, T, U | ||
! This program prints all 3-digit numbers that | ||
program sum_of_cubes | ||
implicit none | ||
integer :: h, t, u | ||
! this program prints all 3-digit numbers that | ||
! equal the sum of the cubes of their digits. | ||
DO H = 1, 9 | ||
DO T = 0, 9 | ||
DO U = 0, 9 | ||
IF (100*H + 10*T + U == H**3 + T**3 + U**3) THEN | ||
PRINT "(3I1)", H, T, U | ||
ENDIF | ||
END DO | ||
END DO | ||
END DO | ||
END PROGRAM SUM_OF_CUBES | ||
do h = 1, 9 | ||
do t = 0, 9 | ||
do u = 0, 9 | ||
if (100*h + 10*t + u == h**3 + t**3 + u**3) then | ||
print "(3I1)", h, t, u | ||
endif | ||
end do | ||
end do | ||
end do | ||
end program sum_of_cubes |
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 |
---|---|---|
@@ -1,22 +1,22 @@ | ||
cc34567 Cubes program | ||
PROGRAM SUM_OF_CUBES | ||
integer profiler(2) / 0, 0 / | ||
save profiler | ||
INTEGER :: H, T, U | ||
!c34567 Cubes program | ||
program sum_of_cubes | ||
integer profiler(2) / 0, 0 / | ||
save profiler | ||
integer :: H, T, U | ||
call TAU_PROFILE_INIT() | ||
call TAU_PROFILE_TIMER(profiler, 'PROGRAM SUM_OF_CUBES') | ||
call TAU_PROFILE_TIMER(profiler, 'program sum_of_cubes') | ||
call TAU_PROFILE_START(profiler) | ||
call TAU_PROFILE_SET_NODE(0) | ||
! This program prints all 3-digit numbers that | ||
! equal the sum of the cubes of their digits. | ||
DO H = 1, 9 | ||
DO T = 0, 9 | ||
DO U = 0, 9 | ||
IF (100*H + 10*T + U == H**3 + T**3 + U**3) THEN | ||
PRINT "(3I1)", H, T, U | ||
ENDIF | ||
END DO | ||
END DO | ||
END DO | ||
do h = 1, 9 | ||
do t = 0, 9 | ||
do u = 0, 9 | ||
if (100*h + 10*t + u == h**3 + t**3 + u**3) then | ||
print "(3I1)", h, t, u | ||
endif | ||
end do | ||
end do | ||
end do | ||
call TAU_PROFILE_STOP(profiler) | ||
END PROGRAM SUM_OF_CUBES | ||
end program sum_of_cubes |
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