Write a program to determine value of Pi (pi-value determination)

c pi-value determination
implicit double precision(a-h,o-z)
sum=0.0
do i=1,1000,1
sum=sum+1/(i**2)
end do
pi=sqrt(6*sum)
write(*,*)’the pi-value is:- ‘,pi
stop
end
c centigrade to fahrenheit conversion
implicit double precision (a-h,o-z)
dimension f(6),c(6)
write(*,*)’provide fahrenheit temp:- ‘
do i=1,6,1
read(*,*) f(i)
c(i)=5*(f(i)-32)/9
write(*,*)’the centrigrade temp is- ‘, c(i)
end do
stop
end

Posted in Uncategorized | 1 Comment

Matrix Addition in Fortran

program test

real a(3,3),b(3,3),c(3,3)
print*,’enter the matrix A’
do 10 i=1,3
read*,(a(i,j),j=1,3)
10 continue
print*,’enter the matrix B’
do 20 i=1,3
read*,(b(i,j),j=1,3)
20 continue
c(i,j)=0
do 30 i=1,3
do 30 j=1,3
c(i,j)=a(i,j)+b(i,j)
30 continue
do 40 i=1,3
write(*,50) (c(i,j),j=1,3)
40 continue
50 format(3f8.2)
end

 

Posted in Uncategorized | 1 Comment

Program to find area of a triangle whose two sides and an angle between them is given

implicit double precision(a-h,o-z)
write(*,*) “please provide the two sides a and b and the angle”
read(*,*) A,B,theta
area=A*B*SIN(theta)
side=DSQRT(A*A+B*B-2*A*B*COS(theta))

write(*,*) ‘area=’,area,’side=’,side
stop
END

Posted in Uncategorized | Leave a comment

Program to find the root of Quadratic Equation

implicit double precision(a-h,o-z)
write(*,*) “please provide the a,b,c coeff”
read(*,*) A,B,C

D=B*B-4*A*C

if(D.GT.0) then
root1=(-B/(2*A))+(SQRT(D))/(2*A)
root2=(-B/(2*A))-(SQRT(D))/(2*A)
write(*,*) root1,root2

elseif(D.EQ.0) then
root1=(-B/(2*A))
root2=root1
write(*,*) root1,root2

else
root1=(-B/(2*A))+(SQRT(-D))/(2*A)
root2=(-B/(2*A))-(SQRT(-D))/(2*A)
a=(root1+root2)/2
b=(root1-root2)/2

write(*,*) ‘realpartroot=’,a, ‘complexpartroot=’,b
endif

stop

END

Posted in Uncategorized | Leave a comment

Hello world!

Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!

Posted in Uncategorized | 1 Comment