Professional Documents
Culture Documents
Sol
Algorithm
1. Display software use.
2. User enters temperature in Fahrenheit.
3. Make the logic.
4. Display the output.
M file
disp('This software converts from fahrenheit to centigrade and kelvin');
C=(F-32)*5/9;
K=C+273.15;
output
This software converts from fahrenheit to centigrade and kelvin
Sol
Algorithm
1. Display software use
2. User enters the value in feet.
3. Make the logic.
4. Display the output.
M file
disp('This software converts feet to yards and centimeters');
yard=(3*feet);
centimeters= (feet*12*2.54);
Output
This software converts feet to yards and centimeters
Sol
Algorithm
1. Display software use
2. Enter value of radius and angle theta.
3. Make the logic
4. Display the output.
Mfile
x=r*cosd(theta);
y=r*sin(theta);
Output
Sol
Algorithm
1. Display software use.
2. Enter value of x and y.
3. Make logic.
4. Display the output.
Mfile
r=sqrt(x^2+y^2);
theta=atand(y/x);
Output
This software converts from rectangular coordinates to polar
Sol
Algorithm
M file
volume=pi*r^2*h;
surfacearea=2*pi*r*h;
Output
This software calculates the volume and surface area of hollow cylinder.
This software calculates the volume and surface area of hollow cylinder.
Sol
Sol
M file
r=input('Enter the radius=');
d=2*r;
output
Enter the radius=4
Sol
M file
i=input('Enter value in in inches=');
c=i*2.54;
output
Sol
Algorithm
Already given in the question.
Mfile
n=input('Enter an integer=');
char=input('Enter an character=','s');
for i=1:n
fprintf('%s\n',char)
end
output
Enter an integer=4
Enter an character=asd
asd
asd
asd
asd
Enter an integer=12
Enter an character=zxc
zxc
zxc
zxc
zxc
zxc
zxc
zxc
zxc
zxc
zxc
zxc
zxc
Sol
Algorithm
Already given in question.
Mfile
n=input('Enter a number=');
for i=1:n
end
Output
Enter a number=6
It happened 6 times
It happened 6 times
It happened 6 times
It happened 6 times
It happened 6 times
It happened 6 times
Enter a number=1
It happened 1 times
Sol
Sol
Sol
Sol
Sol
Sol
Sol
Algorithm
1. Display sript use
2. User enter voltage and current
3. Make the logic
4. Display the resistance in ohms.
Mfile
disp('This script calculates the resistance');
r=(e/i);
output
This script calculates the resistance
Sol
Algorithm
1. Display script use.
2. User enters potiential and current.
3. Make logic
4. Display the output.
Mfile
disp('This script calculates the power');
p=e*i;
Sol
Algorithm
1. Display software use
2. First distance between two points
3. User enters values
4. Make logic
5. Display the distance
6. Second area of triangle using heroes formula
7. User enter values
8. Make logc
9. Display the area.
M file
disp('This software caluclates distance btw two points and area of triangle');
d=sqrt((x1-x2)^2+(y1-y2)^2);
s=(a+b+c)/2;
area=sqrt(s*(s-a)*(s-b)*(s-c));
output
This software caluclates distance btw two points and area of triangle