Program Triangle2 !------------------------------------------------------------------------------ !Program: Triangle Validity and Typing !Author: Chris Harper !Date: 1/31/2008 !------------------------------------------------------------------------------ IMPLICIT NONE !declarations real :: a, b, c logical :: triangle, equilateral, isosceles, scalene triangle = .False.; equilateral = .False.; isosceles = .False.; scalene = .False. !get input vars Print *, "Triangle Validity and Typing" Print *, "Enter 3 lengths: " Read *, a, b, c !test for valid triangle first - no two sides can be less than the third if (((a + b) >= c) .AND. ((b + c) >= a) .AND. ((c + a) >= b)) then triangle = .True. if ((a == b) .OR. (b == c) .OR. (c == a)) then !two sides are equal if ((a == b) .AND. (b == c)) then !all sides are equal equilateral = .True. else isosceles = .True. endif else !no two sides are equal scalene = .True. endif endif !output results Print *, "Triangle: ", triangle Print *, "Equilateral: ", equilateral Print *, "Isosceles: ", isosceles Print *, "Scalene: ", scalene End