求fortran 95的程序

2024-12-17 09:52:03
推荐回答(1个)
回答1:

你好!

PROGRAM MCN
IMPLICIT NONE
INTEGER(4)::a,b,d
INTEGER(4)::i,j,k
WRITE(*,*)"请输入两个整数:"
READ(*,*)a,b
DO i=MIN(a,b),1,-1
IF(MOD(a,i)==0.AND.MOD(b,i)==0)THEN
d=i
WRITE(*,100)a,b,d
100 FORMAT(I8,"和",I8,"的最大公约数是",I8)
EXIT
ENDIF
ENDDO
READ(*,*)j
END PROGRAM MCN
还有就是X,Y有无穷组,你怎么去弄?