Thank you, for all the answers, I tryied with array, but it doesn’t function the I tried with Select Case and it worked! @mecej4 it would work, but the numbers I’ve used was just an examples.
The code:
k1=10
k2=20
k3=30
write (*,*) "Type the number for the desired material:"
write (*,*) "1 - Aluminum"
write (*,*) "2 - Steel"
write (*,*) "3 - Cast Iron"
read *, material
select case (material)
case (1)
K=k1
case (2)
K=k2
case (3)
K=k3
end select
write (*,*) k
You could investigate including “case default” in the latest code example, which would provide you the opportunity to identify if material is not 1, 2 or 3.