This preview shows page 1. Sign up to view the full content.
Unformatted text preview: program factorial implicit none ! Initialize variables Integer :: Num, Fact Integer :: Index_1, Index_2 ! Prompt for input and read the value in as Num write(*,*)'Enter upper bound for factorials: ' read(*,*) Num ! Set Index_1 equal to the even numbers between 0 and the number entered do Index_1 = 0, Num, 2 !Initialize the integer value for which you will multiply by Fact = 1 ! Calculate the factorials of the even numbers do Index_2 = 1, Index_1 Fact = Fact * Index_2 end do ! Output the results of the calculations write(*,*)Index_1, ' ! = ', Fact end do stop end...
View Full Document
- Spring '08
- Computer Programming