!********o*********o*********o*********o*********o*********o*********o**
! This program, given three sides of an alleged triangle, determines the
! type of that triangle.
!
! Inputs
!   s1:             one side of the triangle
!   s2:             another side
!   s3:             yet another side
!
! Outputs
!   isTriangle:    .true.  if the triangle really is a triangle
!                  .false. otherwise
!   isEquilateral: .true.  if the triangle has three equal sides
!                  .false. otherwise
!   isIsosceles:   .true.  if the triangle has two or more equal sides
!                  .false. otherwise
!   isScalene:     .true.  if the triangle has no equal sides
!                  .false. otherwise
!---------------------
! Author:   Bob Harris
! Class:    CMPSC 201F
! Section:  000
! Date Due: 1 Oct 2003
!********o*********o*********o*********o*********o*********o*********o**

PROGRAM Triasmatron

IMPLICIT NONE

REAL    :: s1, s2, s3
LOGICAL :: isTriangle, isEquilateral, isIsosceles, isScalene

! fetch the three sides from the user

PRINT *, "Please enter three sides, in any order"
READ  *, s1, s2, s3

! determine what type of triangle this is, or if it is one at all

isTriangle    = (s1+s2 > s3) .and. (s1+s3 > s2) .and. (s2+s3 > s1)
isEquilateral = isTriangle .and. (s1==s2) .and. (s2==s3)
isIsosceles   = isTriangle .and. ((s1==s2) .or. (s1==s3) .or. (s2==s3))
isScalene     = isTriangle .and. .not. isIsosceles

! tell the user what we think of her triangle

PRINT *, "Triangle is:",    isTriangle
PRINT *, "Equilateral is:", isEquilateral
PRINT *, "Isosceles is:",   isIsosceles
PRINT *, "Scalene is:",     isScalene

END PROGRAM Triasmatron
