Skip to content

Instantly share code, notes, and snippets.

View natebenes's full-sized avatar

Nate Benes natebenes

View GitHub Profile
PROGRAM sumIntegers
IMPLICIT NONE
! Programmer: Nate Benes
! Purpose: Sums the integers from 1 to 100
INTEGER :: i ! For the DO Loop
INTEGER :: total ! To keep a running total
! Initialize our counter
PROGRAM example5
IMPLICIT NONE
REAL,DIMENSION(5):: v1, v2
REAL :: dot
INTEGER :: i
dot = 0
WRITE(*,*) 'Enter the first dataset:'
READ (*,*) v1
PROGRAM example4
IMPLICIT NONE
INTEGER :: input
INTEGER :: mod_out
! start program
DO
WRITE(*,*) "Please enter an integer"
PROGRAM example3
IMPLICIT NONE
INTEGER::in1, in2, sum, diff
110 FORMAT('Enter two three-digit integers')
WRITE(*,100)
WRITE(*,110)
READ(*,250) in1,in2
250 FORMAT(2I3)
PROGRAM example2
IMPLICIT NONE
INTEGER :: n
INTEGER :: nMinusOne
INTEGER :: runningTotal
INTEGER :: out
LOGICAL :: skiploop
SUBROUTINE example1(messyarray, usefulLength, cleanarray)
IMPLICIT NONE
CHARACTER (LEN=12), DIMENSION(*), INTENT(IN) :: messyarray
CHARACTER (LEN=12), DIMENSION(*), INTENT(OUT) :: cleanarray
INTEGER, INTENT(IN) :: usefulLength
CHARACTER (LEN=12) :: swap, caps1, caps2
INTEGER :: i,j,k,l,m, len1, len2, percent
DO i=1, usefulLength
SUBROUTINE example1(messyarray, usefulLength, cleanarray)
IMPLICIT NONE
CHARACTER (LEN=12), DIMENSION(*), INTENT(IN) :: messyarray
CHARACTER (LEN=12), DIMENSION(*), INTENT(OUT) :: cleanarray
INTEGER, INTENT(IN) :: usefulLength
CHARACTER (LEN=12) :: swap, caps1, caps2
INTEGER :: i,j,k,l,m, len1, len2, percent
DO i=1, usefulLength
MODULE circleFunctions
CONTAINS
SUBROUTINE circle(x, y)
REAL (KIND=8), INTENT(IN) :: x
REAL (KIND=8), INTENT(OUT) :: y
IF (x**2 < 1) THEN
y = sqrt(1-x**2)
ELSE
y = 0
END IF
MODULE globalConfig
SAVE
! Project: Twitter.f90
! Author: Nate Benes
! File: config.f90
! Desc: A module to store things that need to be globally available
! Change these to suit your needs
@natebenes
natebenes / gist:311758
Created February 23, 2010 01:57
IOSTAT Property
INTEGER :: readErr, myVar
! some code
READ (*,*,IOSTAT=readErr) myVar
IF (readErr /= 0) THEN
! They are stupid, make them do it again
ELSE
! User did their job
END IF