Created
March 28, 2010 00:42
-
-
Save natebenes/346464 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
PROGRAM ComputeFactorial | |
! @author: Nate Benes | |
USE FactorialModule | |
IMPLICIT NONE | |
INTEGER, DIMENSION(2,10) :: arrayOfNumbers | |
INTEGER :: userInput, factorial | |
INTEGER :: total = 0,i,m,n | |
! One of many ways to fill the array. | |
! reading from a file is also OK | |
DO | |
READ(*,*) userInput | |
IF (userInput < 1) EXIT | |
! Count how many numbers we have entered so far | |
total = total + 1 | |
arrayOfNumbers(1,total) = userInput | |
arrayOfNumbers(2,i) = factorial(userInput) | |
! Keeps us from counting past 10 | |
IF (total == 10) EXIT | |
END DO | |
WRITE(*,60) ((arrayOfNumbers(m,n),m=1,2),n=1,total) | |
60 FORMAT(2I) | |
EXIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment