C Solution of problem 9, page 175, of Nyhoff and Leestma. C The values of three real numbers are check to see if the C could represent the sides of triangle. If so, further tests C are done to see if the sides correspond to an equilateral, C isosceles, or scalene triangle. C C Note that the problem states that an isosceles triangle has "at C least two sides equal". This definition would imply that an C equilateral triangle is also an isosceles triangle. However, we C will use the definition that an isosceles triangle has two, and C only two, sides equal. C C We won't worry about non-positive numbers (though it would be C best to do so). C C John Schneider C CptS 203, HW 3, problem 1 C-------------------------------------------------------------------------- program tritst implicit none real a, b, c logical triang, equil, isos, scal data triang, equil, isos, scal/4*.false./ print *, 'Enter three lengths.' read *, a, b, c if ((a + b .gt. c) .or. (a + c .gt. b) .or. (b + c .gt. a)) then triang = .true. if (a .eq. b .and. a .eq. c) then equil = .true. else if (a .eq. b .or. a .eq. c .or. b .eq. c) then isos = .true. else scal = .true. endif endif print *, 'triang is: ',triang print *, 'equil is: ',equil print *, 'isos is: ',isos print *, 'scal is: ',scal stop end