WRITE A SIMPLE BUT A COMPLETE FORTRAN PROGRAM TO CALCULATE THE AREA OF A TRIANGLE

It would be something like this:

WRITE(6,*)'INPUT Base and Height='
READ(5,*)B,H
AREA=B*H/2.0
WRITE(6,*)'AREA OF TRIANGLE IS ',AREA
STOP
END

Most (old) compilers would require the first 6 characters to be blank in the above program.

STOP is for execution time termination.
END is for compiler to know that this is the end of the subroutine, function or main program.

You can do the other program(s) in a similar way.

Indicate your specific subject in the "School Subject" box, so those with expertise in the area will respond to the question.

Second, please do not use all capitals. Online it is like SHOUTING. Not only is it rude, but it is harder to understand. Thank you.

@psydag, sorry for shouting

@mathmate, thanks for the solution

thank you

edwin

Certainly! Here's a simple and complete Fortran program to calculate the area of a triangle:

```fortran
program calculate_area
implicit none

real :: base, height, area

! Read the values of base and height from the user
write(*,*) 'Enter the base of the triangle:'
read(*,*) base

write(*,*) 'Enter the height of the triangle:'
read(*,*) height

! Calculate the area of the triangle
area = 0.5 * base * height

! Display the result
write(*,*) 'The area of the triangle is:', area

end program calculate_area
```

How to get the answer:
1. Start by declaring the variables `base`, `height`, and `area` of type `real`.
2. Prompt the user to enter the base of the triangle using the `write(*,*)` statement and read the value using `read(*,*)`.
3. Prompt the user to enter the height of the triangle using the `write(*,*)` statement and read the value using `read(*,*)`.
4. Calculate the area of the triangle using the formula `area = 0.5 * base * height`.
5. Display the result to the user using the `write(*,*)` statement.

Note: This program assumes that the input values for base and height are valid real numbers and does not include any error handling.