Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

please use fortran 95 and geanny programm ENGR2216 ortran Programmn Test 1 Durat

ID: 3856945 • Letter: P

Question


please use fortran 95
and geanny programm

ENGR2216 ortran Programmn Test 1 Duration : 75 minutes ID# Section/Instructor: 3o Problem 3: 110 marks] Write a Fortran program to ask select case construct, check if the entered number is negative, zero, or positive; and also check if the entered number is odd or the program should be a positive and odd number. the user to enter an integer number n from the keyboard. By using astruct, check i h en e, zero,or positive, and alks check if the cantered number is od or even. For example, if the user emtered number 3, t of 2

Explanation / Answer

program check

Print *, "Enter an integer number n"

integer::n

read *, n

if(n==0) then

Print *, "zero"

else if (n>0 .AND. n%2==0) then

Print *, "Positive and even "

else if (n>0 .AND. n%2!=0) then

Print *, "Positive and odd "

else if (n<0 .AND. n%2==0) then

Print *, "Negative and even "

else if(n<0 .AND. n%2!=0) then

Print *, "Negative and odd "

  

end if

end program check