+ 1

# Can you provide me code for trigonometry calculator for calculating height or any hints?

Can anyone create a program to take the input and give output to calculate height on the basis of this solution? Real question's ans.: Given, Height=? Adjacent=2000 Tan theta= 30° Tan theta=height/adjacent 30°=h/2000 30°*2000=h (0.577)*2000=h H=1154 Any programming language works and any tip may also work

4 Réponses

+ 3

Just multiply
tan θ × Adjacent
You will get height

+ 3

Diamond Garcia
First you don't need to write all the tan values for angles
There's a module (math module) which contain the tan function
Here's how you can do this :
import math
#Importing the module
#Getting angle
angle = float(input())*math.pi/180
#I have multiplied it by pi(π)/180 to convert it into radians (as used by tan function)
adjacent = float(input())
tan = math.tan(angle)
#Getting tan value for the angle
height = tan*adjacent
print(height)
Still now you have any doubt
Feel free to ask
Hope It Helps You 😊

+ 1

Hacker Badshah ,
Thank you, i will consider it and try to create a very simple calculator which can calculate height

0

Martin Taylor , i hadnt written the code previously...
I have now written; its in beta stage but i ran into some problems.
Can you please review it?
I cant enter proper input:
https://code.sololearn.com/cHk47xsFjmWm/?ref=app