converting degrees and radian
12 views (last 30 days)
how do a make a solution tht prompts user to input (A or B) . A being degree to radian. B being radian to degree. others input error. if prompted A ..it will ask for angle in degree and displays in equivalent radians. if prompted B will ask for a radian and displays in degrees.Should be able to accept both scalar and matrix input/
Daniel Pollard on 2 Feb 2021
option = input("Type A for degree to radians, and B for radians to degrees: ", 's')
if option == "A"
degs = input("Please insert a value in degrees: ")
rads = degs*pi/180;
disp(degs+" degrees = "+rads+" radians")
elseif option == "B"
rads = input("Please insert a value in radians: ")
degs = rads*180/pi;
disp(rads+" radians = "+degs+" degrees")
error("Please insert only A or B")
should do what you want.