by using fortran.90 solve this question...
the pH of an aqueous solution is a measure of its acidity. The pH
scale ranges from 0 to 14, inclusive. A solution with
a pH of 7 is said to be neutral, a solution with a pH greater than
7 is basic, and a solution with a pH less than 7 is acidic.
Write a program that will read value of pH of a solution, and will
print whether it is neutral, basic, or acidic. If the user
enters
an invalid pH, an error message will be printed.
Here's the program in fortran: program phrange implicit none integer :: p ! integer to hold pH value character(len=8) :: type ! string to hold the result print*,"Enter the pH value" !taking input from user read (*) p IF (p < 0) THEN type="error" ! checking for pH in range ELSE IF (p > 14 ) THEN type="error" ! checking for pH in range ELSE IF (p == 7) THEN type="neutral" ! checking for pH being neutral ELSE IF (p < 7) THEN type="acidic" ! checking for pH being acidic ELSE type="basic" ! checking for pH being basic END IF
print *, type ! printing result
end program phrange
Get Answers For Free
Most questions answered within 1 hours.