Search This Blog

#Day38 #100DaysChallenge- Matlab Loops| Alphabet z

#Day38-Alphabet Z
Task:
Print alphabet z  as shown below by taking user input for the 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 alphaz(x)
k=x;
for i=1:1:x
    if i==1||i==x
        for j=1:1:x
            fprintf('*');
            fprintf('\t');
        end
    else
                for j=1:1:k
                    fprintf('\t');
                end
                   
    end
    fprintf('*');
    fprintf('\n');
    k=k-1;
end

Sample Input and Output
>> alphaz(5)

* * * * * *
*
*
*
* * * * * *
>> alphaz(6)
* * * * * * *
*
*
*
*
* * * * * * *
Click here for Video Description





Live Support: t.me/matlabirawen




                                       

2 comments:

  1. Excellent Blog! I would like to thank for the efforts you have made in writing this post. I am hoping the same best work from you in the future as well. I wanted to thank you for this websites! Thanks for sharing. Great websites! 360DigiTMG PMP Certification
    360DigiTMG PMP Course in Malaysia
    360DigiTMG PMP Course
    360DigiTMG PMP Training in Malaysia
    360DigiTMG PMP Training

    ReplyDelete
  2. Awesome blog. I enjoyed reading your articles. This is truly a great read for me. I have bookmarked it and I am looking forward to reading new articles. Keep up the good work!
    data analytics course
    big data analytics malaysia
    big data course

    ReplyDelete

MATLAB