can someone help me out with this

i have to create a script for this problem but i keep getting an error. Why?
metaltype=input('','s');
weight=input('');
price=0;
if(strcmp(metaltype,'gold'))
price=weight*11750;
elseif(strcmp(metaltype,'silver'))
price=weight*177;
end
fprintf('price = %d',price);

댓글 수: 3

Jim Riggs
Jim Riggs 2020년 3월 5일
편집: Jim Riggs 2020년 3월 5일
If you showed the error message, it would be easier to help you.
per isakson
per isakson 2020년 3월 5일
편집: per isakson 2020년 3월 5일
The if-statement doesn't handle the case c) copper.
Srivardhan Gadila
Srivardhan Gadila 2020년 3월 9일
@Liam Sullivan can you provide the error you are getting?

답변 (0개)

이 질문은 마감되었습니다.

질문:

2020년 3월 4일

마감:

2021년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by