program main implicit none real A, B, Alpha, Betta, Gamma, degToRad, RadToDeg, PI real area_triangle real min_ang real cos_min_ang integer ch common /Global/ Betta, A, B common /angles/ Alpha, Gamma common /degree/degToRad, RadToDeg common /const/PI PI = 3.1415926 degToRad = PI/180 RadToDeg = 180/PI 10 write (*,*) '1 Entering a new triangle' write (*,*) '2 Calculated a area triangle' write (*,*) '3 Calculated the minimum angle in degree' write (*,*) '4 Calculating the cosine of the minimum angle' write (*,*) '5 Exit' read (*,*) ch goto (1,2,3,4,5), ch write (*,*) 'wrong argument' goto 10 1 call input_p goto 10 2 print *, 'Triangle area is: ', area_triangle() goto 10 3 print *, 'Minimum angle: ', min_ang() goto 10 4 print *, 'Cosine of the minimum angle: ', cos_min_ang() goto 10 5 stop end subroutine input_p implicit none real A, B, Betta, PI, degToRad, RadToDeg common /degree/degToRad, RadToDeg common /const/PI common /Global/ Betta, A, B write (*,*) 'input A' read (*,*) A write (*,*) 'input B' Read (*,*) B write (*,*) 'input Betta' Read (*,*) Betta Betta = Betta*degToRad return end real function area_triangle() implicit none real PI real A, B real Alpha, Betta, Gamma real temp common /const/PI common /Global/ Betta, A, B common /angles/ Alpha, Gamma temp=sin(Betta)*A/B if(abs(temp).LE.1) then Alpha = Asin(temp) Gamma = PI - Alpha - Betta area_triangle = A*B*sin(Gamma)/2 else area_triangle = 0 endif return end real function min_ang() implicit none real Alpha, Betta, Gamma, degToRad, RadToDeg real A, B common /Global/ Betta, A, B common /angles/ Alpha, Gamma common /degree/degToRad, RadToDeg real PI common / const/ PI if(Alpha.LT.Betta) then if(Alpha.LT.Gamma) then min_ang = Alpha/degToRad else if(Gamma.LE.Alpha) then min_ang = gamma*RadToDeg endif else if(Betta.LE.Alpha) then if(Betta.LT.Gamma)then min_ang=Betta*RadToDeg else if(Gamma.LE.Betta) then min_ang=gamma*RadToDeg endif endif return end real function cos_min_ang() implicit none real min_ang real PI, degToRad, RadToDeg common / degree / degToRad, RadToDeg common / const/ PI cos_min_ang=cos(min_ang()*degToRad) return end