Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

#Day79 #100DaysChallenge- Matlab Loops|Standing Line and Sleeping Line

#Day79-Standing Line and sleeping Line

Task:

Write a code to Print Below pattern
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *

Note: This code can be done using the in-built command. But for the challenge, I am trying to avoid those.

Matlab code


function standing_line(n,r)
while r>=1
    for i=1:1:n
        fprintf('*');
        fprintf('\t');
        
       
    end
    fprintf('\n');
    r=r-1;
end
end

Sample Input and Output

>> standing_line(10,4)
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
* * * *
>> standing_line(10,4)
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *
* * * * * * * * * *

Click here for Video Description




No comments

Popular Posts

Followers