Flow Chart Start: Input Mass Input Distance
Flow Chart Start: Input Mass Input Distance
Flow Chart Start: Input Mass Input Distance
START
LENGTH
OR MASS?
Cm = in*2.54 g = kg*1000
In = ft*12 kg = lb/2.2
Ft = cm/30.48 lb = g/453.592
PRINT PRINT
Cm,in,ft g,kg,lb
END
PROBLEM
In engineering field unit conversion is important so that you can convert standard units
from one form to another according to the requirement. The need for the basic
conversion has always existed in this field for different purposes. Conversion of Si to
English or vice versa is also important in this field. Other counties are using different
kind of measurements. As an engineer, if you encounter this kind of problem you can
easily convert one unit to another in order to fulfill your desire or what is it required.
SCRIPT
clc
clear all
d= input('Enter the Input Distance');
i= input('Enter the input(cm,in,ft): ');
o= input('Enter output units to convert to(cm,in,ft): ');
switch i
case 'cm'
if o=='in'
x=d/2.54;
else
if o=='ft'
x=d/30.48;
else
if o=='cm'
x=d
end
end
end
case 'in'
if o=='in'
x=d;
else
if o=='ft'
x=d/12;
else
if o=='cm'
x=2.54*d;
end
end
end
case 'ft'
if o=='in'
x=d*12;
else
if o=='ft'
x=d;
else
if o=='cm'
x=d*30.48;
end
end
end
str = fprintf('%d %s = %d %s',d,i,x,o);
otherwise
disp('wrong input');
end
ENS 322
(T-TH/1:00-2:30)
Submitted by:
Submitted to: