- #1
DoremiCSD
- 10
- 0
Fortran 90:(Description in program how to continue it)
Write a program in Fortran 90 (not fortran 77) that reads from the user 4 integers a, b, c, d. The program should first check if applicable inequality
a ≤ b, c ≤ d.
If not then it should asking again numbers from the user until they have given numbers satisfying these inequalities. Once your program reads these numbers should
1. to print the squares of integers k such that is
a ≤ k ≤ b.
2. To print the product of all integers r is such that
c ≤ r ≤ d.
its says that the program should asking the user to give numbers until satisfying a<=b and c<=d. This will be done with loop?( i don't know how to do this and i stucked).Still how i can find the squares of integers k and the product of all integers r?( i want only an description of how to do it to finish the program)
program sub
implicit none
integers :: a, b, c, d
print *, "Give me an integer a:"
read *, a
print *, "Give me an integer b:"
read *, b
print *, "Give me an integer c:"
read *, c
print *, "Give me an integer d:"
read *, d
if(a .ge. b) then
print *, "Invalid."
stop
endif
if(c .ge. d) then
print *, "Invalid."
stop
endif
Homework Statement
Write a program in Fortran 90 (not fortran 77) that reads from the user 4 integers a, b, c, d. The program should first check if applicable inequality
a ≤ b, c ≤ d.
If not then it should asking again numbers from the user until they have given numbers satisfying these inequalities. Once your program reads these numbers should
1. to print the squares of integers k such that is
a ≤ k ≤ b.
2. To print the product of all integers r is such that
c ≤ r ≤ d.
Homework Equations
its says that the program should asking the user to give numbers until satisfying a<=b and c<=d. This will be done with loop?( i don't know how to do this and i stucked).Still how i can find the squares of integers k and the product of all integers r?( i want only an description of how to do it to finish the program)
The Attempt at a Solution
program sub
implicit none
integers :: a, b, c, d
print *, "Give me an integer a:"
read *, a
print *, "Give me an integer b:"
read *, b
print *, "Give me an integer c:"
read *, c
print *, "Give me an integer d:"
read *, d
if(a .ge. b) then
print *, "Invalid."
stop
endif
if(c .ge. d) then
print *, "Invalid."
stop
endif