What is the final value of the variable ans in the following Fortran 90:

	x=1.0
	y=2.0
	z=3.0
	ans=0.0
	if (z>2.0) then     
	  ans = 1.0       
	else if (z>= 3.0) then 
	  ans = 2.0
	else if (y == 2.0) then
	  ans = 3.0    
	else
	  ans = 4.0
	end if   

0.0

1.0

2.0

3.0

4.0


Back to the 201 Homepage or Back to the main exercise reference page