Skip to content

Instantly share code, notes, and snippets.

@natebenes
Created March 10, 2010 21:06
Show Gist options
  • Save natebenes/328399 to your computer and use it in GitHub Desktop.
Save natebenes/328399 to your computer and use it in GitHub Desktop.
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
total = 0
! I can set this up a few different ways,
! but this is the simplest
! Loop from 1 to 100 and count by 1's
DO i=1,100,1
total = total + i
END DO
WRITE(*,*) total ! Display the output to the screen
END PROGRAM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment