#Day89#100DaysChallenge- Matlab Loops | Differentiate Odd and Even lines
#Day89-Differentiate Odd and Even lines
Task:
Write a code to Differentiate Odd and Even lines.Get user Input for number of rows
r-10;&-odd.*=even
&
*
&
*
&
*
&
*
&
*
Note: This code can be done using the in-built command. But for the challenge, I am trying to avoid those.
Matlab code
function differentiateevenoddlines(r)
for i=1:1:r
if mod(i,2)==0
fprintf('*');
else
fprintf('&');
end
fprintf('\n');
end
Click here for Video description.
No comments