Sunday, May 17, 2015

write a fortran program to examine the point x1,y1 lies inside/outside/on circle


1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
!write a fortran program to examine the point x1,y1 lies inside/outside/on circle
!Author: mannaf
program area_circle
implicit none
real::x,y,x1,y1,h,k,r,s
print*,'enter the value of x,y'
read*,x,y
print*,'enter the value of h,k'
read*,h,k
print*,'enter the value of x1,y1'
read*,x1,y1

r=sqrt((x-h)**2+(y-k)**2)
s=sqrt((x1-h)**2+(y1-k)**2)

if(r==s) then
print*,'the point lies on the circle'
elseif(r>s) then
print*,'the point lies inside of the circle'
else
print*,'the point lies outside of the circle'
end if
end program area_circle

Saturday, May 16, 2015

write a fortran program vertices are given verify its square or Rhombus or Parallelogram or rectangle


1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
!write a fortran program vertices are given verify its square or Rhombus or Parallelogram or rectangle
!Author: Md. Abde Mannaf
program cheak_four
    implicit none
    real::x1,x2,x3,x4,y1,y2,y3,y4,a,b,c,d,p,q
    print*,'enter the value of x1 & y1'
    read*,x1,y1
    print*,'enter the value of x2 & y2'
    read*,x2,y2
    print*,'enter the value of x3 & y3'
    read*,x3,y3
    print*,'enter the value of x4 & y4'
    read*,x4,y4
    a=sqrt((x1-x2)**2+(y1-y2)**2)
    b=sqrt((x2-x3)**2+(y2-y3)**2)
    c=sqrt((x3-x4)**2+(y3-y4)**2)
    d=sqrt((x4-x1)**2+(y4-y1)**2)
    p=sqrt((x1-x3)**2+(y1-y3)**2)
    q=sqrt((x2-x4)**2+(y2-y4)**2)
if(a==c .and. b==d .and. a/=b .and. p==q ) then
    print*,'this is rectangle'

    else if(a==c .and. b==d .and. a/=b .and. p/=q ) then
    print*,'this is Parallelogram'

    else if( a==b .and. b==c .and. c==d .and. d==a .and. p==q ) then
    print*,'this is square'

    else if( a==b .and. b==c .and. c==d .and. d==a .and. p/=q ) then
    print*,'this is Rhombus'
    else
        print*,'none of them'
    end if
end program cheak_four

Tuesday, March 31, 2015

Write a Fortran Program finds big number


1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
!author:Md. Abde Mannaf
!The program finds big number
program big_number
    implicit none
    integer::a,b,c,big
    print*,'enter the value of a,b,c'
    read*,a,b,c
    if(a>b) then
        if(a>c) then
            big=a
        else
            big=c
        end if
    else
        if(b>c) then
            big=b
        else
            big=c
        end if
    end if
    print*,'biggest number is =',big
end program big_number

Write a Fortran program & finds area,circumference and vol of a circle


1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
!author:Md. Abde Mannaf
!The program finds area,circumference  and vol of a circle
program area_vol
    implicit none
    real::area,cir,vol,r
    real,parameter::pi=3.1416
    print*,'Enter the value of radus='
    read*,r
    area=pi*r**2
    vol=(4.0/3.0)*pi*r**3
    cir=2*pi*r
    print*,'area of the circle=',area
    print*,'volume of the circle=',vol
    print*,'circumference of the circle=',cir
end program area_vol

write a program & finds any roots of 2nd degree Equation. ax^2+bx+c=0


1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
!author:Md. Abde Mannaf
!ax^2+bx+c=0
!The program finds any roots of 2nd degree Equation
program roots_eqn_any
    implicit none
    real::a,b,c,root1,root2,d,p,q
    print*,'enter the value of a,b,c'
    read*,a,b,c
    d=b**2-4.0*a*c
    if(d>=0.00) then
        root1=-b+sqrt(d)
        root2=-b-sqrt(d)
    print*,'root one is=',root1
    print*,'root two is=',root2
    else
        p=-b/(2.0*a)
        q=sqrt(abs(d))
        print*,'1st root',p,'+i',q
        print*,'2st root',p,'-i',q

    end if
end program roots_eqn_any

Write a Fortran Program Convert Celsius to Fahrenheit


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
! Author: Mannaf
!temp conversation
program temp_conversition
    implicit none
    real ::fahrenheit,celsius
      print*,"type value celsius"
    read*,celsius
      print*,"celsius"
    fahrenheit=1.8*celsius+32.0
      print*, "fahrenheit=", fahrenheit
end program temp_conversition

Write a Fortran Programme find area and input three point of Triangle


1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
!Author:Md. Abde Mannaf
!any point given and putting value
!The program finds area of triangle & input point
program area_triangle
implicit none

real::area,s,sqrt,x1,y1,x2,y2,x3,y3,p,a,b,c
print*,'enter the value of three sides of triangle x1,y1'
read*,x1,y1

print*,'enter the value of three sides of triangle x2,y2'
read*,x2,y2

print*,'enter the value of three sides of triangle x3,y3'
read*,x3,y3

a=sqrt((x2-x1)**2+(y2-y1)**2)
b=sqrt((x3-x2)**2+(y3-y2)**2)
c=sqrt((x1-x3)**2+(y1-y3)**2)

if(a+b>c .and. b+c>a .and. c+a>b) then
s=(a+b+c)/2
area=sqrt(s*(s-a)*(s-b)*(s-c))
print*,'area of triangle =',area
p=2*s
print*,'perimeter is=',p
else
print*,'triangle is not valid '

end if

end program area_triangle