Fortran Examples...........

1
!write a program to read the radius of acircle and compute its area and circumference

program circular_case

implicit none

real :: radius,area,circumference

read*,radius

print*,"radius=",radius,"unit"

circumference=2*22*radius/7

print*,"circumference=",circumference,"unit"

area= 22*(radius**2)/7

print*,"area=",area,"square unit"

end program circular_case


2!Write a program to convert Celsius  temperature to  fahrenheit

Program fahrenheit_celsius!Write aprogram to convert cuselsi  temperature to  fahrenheit

Program fahrenheit_celsius

implicit none

real :: fahrenheit,celsius

read*,celsius

fahrenheit=(9*celsius)/5+32

print*,"celsius=",celsius," ","fahrenheit=",fahrenheit

end program fahrenheit_celsius

implicit none

real :: fahrenheit,celsius

read*,celsius

fahrenheit=(9*celsius)/5+32

print*,"celsius=",celsius," ","fahrenheit=",fahrenheit

end program fahrenheit_celsius

3

 !Write aprogram to convert pounds to kilogram.

program pound_kg

implicit none

real :: pound,kg

read*,pound

print*,"pound=",pound

kg=pound*0.4536

print*,"kg=",kg

end program pound_kg

4

!write a program to evalute the following expression.w=a/s(s-a);x=wa;t=x/s**(-a)
program arithmetic_expression

implicit none

real ::a,s,w,x,t

Print*,"please type the value of 'a','s' ;(where 'a' not equal to 's')"

read*,a,s

print*,"a=",a,"s=",s
w=a/(s*(s-a))

x=w*a

t=x/(s**(-a))

print*,"w=",w,"x=",x,"t=",t

end program arithmetic_expression


5
!write a program to evalute T

!T=.0092*2a*[log(4a**2/b)-log(asqrt(2-L))]+0.004*[a**2*(asqrt(2-L) +0.45*b]

!given a=15.2,b=10.2,L=1.2 .

program calculation_of_T

implicit none

real::T,a,b,L

print*,"please type the values of 'a','b','L'."

read*,a,b,L

print*,"a=",a,"b=",b,"L=",L

print*,"T=.0092*2a*(log(4a**2/b)-log(asqrt(2-L))]+0.004*[a**2*(asqrt(2-L) +0.45*b)"

T=.00092*2.0*a*(log 10(4.0*(a**2)/b)-log 10(a*(sqrt(2-L)))) + 0.004*((a*(a*(sqrt(2-L)))) + 0.45*b)

print*,"T=",T

end program calculation_of_T

6
!given the x,y coordinates of a point write a program to find its r,theta coordinates(r=sqrt(x**2+y**2),theta=inv tan(y/x)

program cartesian_to_polar_coordinate

implicit none

real ::x,y,r,theta
real,parameter ::pi=3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067

print*,"please entre the values of 'x' and  'y' with comma in between them"

read*,x,y

print*,"x=",x,"y=",y

r=sqrt(x**2+y**2)

theta=atan(y/x)!theta in radian
theta=180*theta/pi

print*,"r=",r,"theta=",theta,"degree"

end program cartesian_to_polar_coordinate


7
!Given a five digit number write a program which will reverse the digit and print it.

program five_digit_number_to_reverse_digit

implicit none

integer::number,digit1,digit2,digit3,digit4,digit5,reverse_number

print*,"please entre the five digits number which digits would be reverse"

read*,number

print*,"the number is=",number

digit1=mod(number,10)!give first digit

number=number*.1!number became four digit

digit2=mod(number,10)!getting second digit

number=number*.1!number become three digit

digit3=mod(number,10)!getting third digit

number=number*.1!number become two digit

digit4=mod(number,10)!getting fourth digit

number=number*.1!number now became one digit this is the fifth digit

digit5=mod(number,10)

reverse_number=digit5*1+digit4*10+digit3*100+digit2*1000+digit1*10000

print*,"The revrese number is=",reverse_number

end program five_digit_number_to_reverse_digit






Popular posts from this blog

Some Funny Mathematical Questions

Puthon3

পৃথিবীর কোনো এক আদিম সকাল