erfejm
Joined: 25 Sep 2016 Posts: 7
|
Posted: Sun Oct 02, 2016 1:39 am Post subject: |
|
|
There seems to be an exception though, whenever I run an .exe file that ask the user if they want to use the program again, the program runs normally. Code: |
Program Fibonacci
Integer :: n, m
11 Print*, "Please input a number"
Read*, n
m = 0
o = 1
print*, o
z = n-1
Do i=1, z
t = m + o
m = o
o = t
print*, t
End do
write (*,*) 'Program has finished; prompt to exit'
12 Print*, "Do you want to use the program again? enter 1 for yes and 2 for no"
Read*, ans
!If user input values other than 1 and 2 then input error
If (ans > 2 .or. ans < 0 ) Then
Print*, "Error"
GoTO 12
!Else send then back to the start
Else If (ans == 1) then
Go TO 11
Else
Print*, "Thank you for using my program!! :)"
End if
End program Fibonacci
|
|
|