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 Comments

Jim Riggs
Jim Riggs on 5 Mar 2020
Edited: Jim Riggs on 5 Mar 2020
If you showed the error message, it would be easier to help you.
per isakson
per isakson on 5 Mar 2020
Edited: per isakson on 5 Mar 2020
The if-statement doesn't handle the case c) copper.
@Liam Sullivan can you provide the error you are getting?

Answers (0)

This question is closed.

Asked:

on 4 Mar 2020

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!