How to display units with my answer?

37 次查看(过去 30 天)
prompt = 'Enter mass in pounds:';
x = input(prompt);
y = x*0.4536;
disp (y);
This is my current script and i want to have the answer display with 'kg' next to the answer and i cant figure out how to do it.

采纳的回答

Elysi Cochin
Elysi Cochin 2020-3-22
编辑:Elysi Cochin 2020-3-22
fprintf('%g kg\n', y)

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by