一个公式写成Fortran语言代码
1个回答
展开全部
program baidu
integer::I,J,N
real*8::Cr,T
real*8,dimension(:),allocatable ::P,X
N=3 !变量X的个数
Cr=5.0d0 !常量Cr,自己设定
T=4.0d0 !常量T,自己设定
allocate(P(N),X(N))
! =======读入变量X的值
do I=1,N
write(*,*)"请输入第 ",I," 个变量的值:"
read(*,*)X(I)
enddo
! =======读入变量X的值
do I=1,N
P(I)=(-4.2d0/Cr**2*X(I)+2.9/Cr)*T
write(*,*)“第 ”,I," 个变量X对应结果:",P(I)
enddo
end
integer::I,J,N
real*8::Cr,T
real*8,dimension(:),allocatable ::P,X
N=3 !变量X的个数
Cr=5.0d0 !常量Cr,自己设定
T=4.0d0 !常量T,自己设定
allocate(P(N),X(N))
! =======读入变量X的值
do I=1,N
write(*,*)"请输入第 ",I," 个变量的值:"
read(*,*)X(I)
enddo
! =======读入变量X的值
do I=1,N
P(I)=(-4.2d0/Cr**2*X(I)+2.9/Cr)*T
write(*,*)“第 ”,I," 个变量X对应结果:",P(I)
enddo
end
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询