Question: PROGRAM TrianglePerimeterandArea IMPLICIT NONE REAL::A,B,C !Defining 3 sides a,b,c, semi-perimeter S, Area and Logical conditions. REAL::S REAL::Area REAL::Perimeter LOGICAL::Condition1,Condition2 READ(*,*)A,B,C WRITE(*,*)Please enter value of side
PROGRAM TrianglePerimeterandArea IMPLICIT NONE REAL::A,B,C !Defining 3 sides a,b,c, semi-perimeter S, Area and Logical conditions. REAL::S REAL::Area REAL::Perimeter LOGICAL::Condition1,Condition2 READ(*,*)A,B,C WRITE(*,*)"Please enter value of side A",A WRITE(*,*)"Please enter value of side B",B WRITE(*,*)"Please enter value of side C",C WRITE(*,*) !Setting condition 1 and 2 which states A,B and C as positive numbers Condition1=(A>0.).AND.(B>0.).AND.(C>0.) Condition2=(A+B>C).AND.(A+C>B).AND.(B+C>A) IF(Condition1.AND.Condition2)THEN S=(A+B+C)/2 ! S is a semi perimeter Perimeter=2.0*S WRITE(*,*)"The perimeter of the triangale is ",Perimeter ! The area of a triangle can be calculated using Heron's formula. Area=SQRT(S*(S-A)*(S-B)*(S-C)) WRITE(*,*)"The area of the triangale is ",Area ELSE WRITE(*,*)"Sorry this is not a triangle. Unable to calculate perimeter and area" END IF END PROGRAM TrianglePerimeterandArea !This program(Fortran95) can be compiled with no errors and can be linked but unable to be start.
!Can someone help me to identify the error
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
