#Day28 #100DaysChallenge- Matlab Loops| HollowRightangledTriangle
#Day28-HollowRightangledTriangle
Task:
Print Hollow Right angled Triangle as shown below by taking user input for number of lines or 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 hollowrightangledtriangle(x)
for i=1:1:x
    fprintf('*');
    for j=1:1:i
        fprintf('\t');
    end
        fprintf('*');
        fprintf('\n');
end
        for i=1:1:x+1
            fprintf('*');
            fprintf('\t');
        end
end
 Sample Input and Output
>> hollowrightangledtriangle(10)
* *
*  *
*   *
*    *
*     *
*      *
*       *
*        *
*         *
*          *
* * * * * * * * * * * >> 
>> hollowrightangledtriangle(7)
* *
*  *
*   *
*    *
*     *
*      *
*       *
* * * * * * * * 
Click here for video Description
MATLAB Book for the beginner: https://amzn.to/3fTfmTa
 
 
 
 
 
 
 
%206th%20Edition,%20Kindle%20Edition.jpg) 
 
 
 Posts
Posts
 
 
 
 
 
 
 
 
No comments