#Day15- #100DaysChallenge- Matlab Loops| Geometric Shapes:Part1
#Day15-Geometric Shapes: Part1
Task: Print Square and Rectangle. Take length and breadth as user input if it is square then length=breadth.
Note: This code can be done using the in-built command. But for the challenge, I am trying to avoid thoseMatlab code:
function geometric_1(l,b)
for i=1:1:l
    if i==1 || i==l
        %fprintf('*')
        for j=1:1:b
            fprintf('*')
            fprintf('\t')
        end
     else
        fprintf('*');
        for j=2:1:b
            fprintf('\t');
        end
            fprintf('*');
    end
            fprintf('\n');
            fprintf('\n');
end
 Sample Input and Output
>> geometric_1(6,6)
* * * * * * 
*     *
*     *
*     *
*     *
* * * * * * 
>> geometric_1(6,9)
* * * * * * * * * 
*        *
*        *
*        *
*        *
* * * * * * * * * 
>> geometric_1(9,6)
* * * * * * 
*     *
*     *
*     *
*     *
*     *
*     *
*     *
* * * * * * 
Note: From this code, you will get to know about '\t','\n' sizes.
Click Here for Video Description
Join us on Telegram:
https://t.me/matlabirawen
Join us on Facebook Group:https://www.facebook.com/groups/matlabcodes
Join us on Facebook Group:https://www.facebook.com/groups/matlabcodes
 
 
 
 
 
 
 
%206th%20Edition,%20Kindle%20Edition.jpg) 
 
 
 Posts
Posts
 
 
 
 
 
 
 
 
No comments