求问一个FORTRAN小程序输出NAN的原因。
PROGRAMexam4_15IMPLICITNONEREALa,b,cREAL*16cda,cdb,cdc,aa,ab,acPRINT*,"输入三角形三边长,并判断是否...
PROGRAM exam4_15 IMPLICIT NONE REAL a, b, c REAL*16 cda, cdb, cdc, aa, ab, ac PRINT *, "输入三角形三边长,并判断是否能构成三角形,若能,则输出对应的三个角。" READ *, a, b , c IF(a + b.gt.c.and.b + c.gt.a.and.c + a.gt.b) THEN cda = (b * b + c * c - a * a) / 2 * b * c aa = ACOSD(cda) cdb = (c * c + a * a - b * b) / 2 * c * a ab = ACOSD(cdb) cdc = (a * a + b * b - c * c) / 2 * a * b ac = ACOSD(cdc) PRINT 100, "边a = ", a, " 所对的角为A = ", aa PRINT 100, "边b = ", b, " 所对的角为B = ", ab PRINT 100, "边c = ", c, " 所对的角为C = ", ac100 FORMAT(A, F8.2, A, F8.2) ELSE PRINT *, "该三边无法构成三角形。" ENDIF PAUSEEND
编译环境是 VS 2013+ Intel Composer XE 2013 SP1 展开
编译环境是 VS 2013+ Intel Composer XE 2013 SP1 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询