i solved most of it. but i don\'t know what to write inside the (fprintf)s :::::
ID: 3759030 • Letter: I
Question
i solved most of it.
but i don't know what to write inside the (fprintf)s
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
clc
clear all
x=input('Enter a value of the x coordinate: ')
y=input('Enter a value of the y coordinate: ')
p=hypot(x, y)
if x==0 & y==0
fprintf('')
fprintf('')
elseif x~=0 & y==0
fprintf('')
fprintf('')
elseif x==0 & y~=0
fprintf('')
fprintf('')
elseif x>0 & y>0
fprintf('')
fprintf('')
elseif x<0 & y>0
fprintf('')
fprintf('')
elseif x<0 & y<0
fprintf('')
fprintf('')
else x>0 & y<0
fprintf('')
fprintf('')
end
Explanation / Answer
clc
clear all
x=input('Enter a value of the x coordinate: ')
y=input('Enter a value of the y coordinate: ')
p=hypot(x, y)
if x==0 & y==0
fprintf("Point(%.2f, %.2f) is located on the origin",x,y);
elseif x~=0 & y==0
fprintf("Point(%.2f, %.2f) is located on the x-axis",x,y);
fprintf("Point(%.2f, %.2f) is %.2f units away from the origin",x,y,p);
elseif x==0 & y~=0
fprintf("Point(%.2f, %.2f) is located on the y-axis",x,y);
fprintf("Point(%.2f, %.2f) is %.2f units away from the origin",x,y,p);
elseif x>0 & y>0
fprintf("Point(%.2f, %.2f) is located in quadrant I",x,y);
fprintf("Point(%.2f, %.2f) is %.2f units away from the origin",x,y,p);
elseif x<0 & y>0
fprintf("Point(%.2f, %.2f) is located in quadrant II",x,y);
fprintf("Point(%.2f, %.2f) is %.2f units away from the origin",x,y,p);
elseif x<0 & y<0
fprintf("Point(%.2f, %.2f) is located in quadrant III",x,y);
fprintf("Point(%.2f, %.2f) is %.2f units away from the origin",x,y,p);
else x>0 & y<0
fprintf("Point(%.2f, %.2f) is located in quadrant IV",x,y);
fprintf("Point(%.2f, %.2f) is %.2f units away from the origin",x,y,p);
end
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.