-
Notifications
You must be signed in to change notification settings - Fork 1
/
triangle.f90
74 lines (51 loc) · 1.36 KB
/
triangle.f90
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
!Rachel's Code
program triangle
implicit none
real::a,b,c,theta,thetar
real:: pi = 3.14
write(*,*)'Enter the length of the hypotenuse C:'
read(*,*)c
write(*,*)'Enter the angle theta in degrees'
read(*,*)theta
thetar = theta * 180 / pi
a=c*cos(thetar)
b=c*sin(thetar)
write(*,*)'The length of adjacent side is', a
write(*,*)'The length of opposite side is', b
! Alex's fortran code
program triangle
real:: a,b,c,theta
write(*,*) 'Enter the length of hypotenuse C:'
read(*,*) c
write(*,*)'Enter the angle THETA in degrees'
read(*,*) theta
a=c*cos(theta)
b=c*sin(theta)
write(*,*) 'The length of adjacent side is ', a
write(*,*) 'The length of opposite side is ', b
! Matthew's code
real :: a,b,c,theta
real, parameter :: pi = 3.1415926536
write(*,*) "Enter the length of hypotenuse C:"
read(*,*) c
write(*,*) "Enter the angle theta in degrees:"
read(*,*) theta
theta = theta*180/pi
a = c*cos(theta)
b = c*sin(theta)
write(*,*) "The length of the adjacent side is",a
write(*,*) "The length of the opposite side is",b
! Ethan's code
real :: a, b, c, theta, degree
real, parameter :: pi = 3.14159265358979323846
write(*,*) 'enter the length of hypotenuse'
read(*,*) c
write(*,*) 'enter the angle in degrees'
read(*,*) theta
degree = theta * 180/pi
a=c * cos(degree)
b=c * sin(degree)
write(*,*) 'adjacent side is', a
write(*,*) 'opposite side is', b
stop
end program triangle