#Day93#100DaysChallenge- Matlab Loops | Plus Symbol
#Day93-Plus Symbol
Task:
Write a code for plus symbol pattern as shown below.Get user Input for number of rows
+
+
+
+
+
+
+ + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
Note: This code can be done using the in-built command. But for the challenge, I am trying to avoid those.
Matlab code
function plussymbol(x)
for i=1:1:x
if i==floor(x/2)
for j=1:1:x
fprintf('+');
fprintf('\t');
end
else
for space=1:1:floor(x/2)
fprintf('\t');
end
fprintf('+');
end
fprintf('\n');
end
>> plussymbol(15)
+
+
+
+
+
+
+ + + + + + + + + + + + + + +
+
+
+
+
+
+
+
+
Click here for Video description
No comments