I dont know where im going wrong with the code

adj = 20; % ft
opp = 200; % ft
% pythagorus formula a^2+b^2=c^2
c^2 = adj^2+opp^2;
c^2 = sqrt(ans)

 채택된 답변

Sudheer Bhimireddy
Sudheer Bhimireddy 2020년 8월 11일

0 개 추천

The left-hand side should be the variable alone. Change that to
c = sqrt(adj^2 + opp^2)
c^2 cannot be the variable name as it has mathematical operator, on the other hand, c2 is a valid variable name.

댓글 수: 2

thankyou
i fixed it and it worked so thankyou

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by