Fortran

👩‍🌾Fortran--数据类型:实型

2019-03-25  本文已影响0人  YI_YI_
1: 浮点型
program division
    implicit none
    !Define real variables
    real :: p,q,realRes
    
    !Define integer variables
    integer :: i,j,intRes
    
    !Assigning values
    p = 2.0
    q = 3.0
    i = 2
    j = 3
    
    !floating point division
    realRes = p/q
    intRes = i/j
    
    print *,realRes
    print *,intRes
    read*
    endProgram division
结果:
result.png
上一篇 下一篇

猜你喜欢

热点阅读