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

Search This Blog

#Day27 #100DaysChallenge- Matlab Loops| Printing Greater Than symbol

#Day27-Printing Greater than Symbol

Task:
Print Greater than symbol as shown below by taking user input for number of lines.
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
@
Matlab Code:

function greaterthansymbol(x)

 

for i=1:1:x

   

    for j=1:1:i

        fprintf('\t')

    end

  

    fprintf('@')

    fprintf('\n');

end

   

    for i=x:-1:1

       

        for j=1:1:i

            fprintf('\t')

        end

      

        fprintf('@')

        fprintf('\n');

end

end

 



            

Sample Input and Output
>> greaterthansymbol(7)
@
@
@
@
@
@
@
@
@
@
@
@
@
@
>> greaterthansymbol(5)
@
@
@
@
@
@
@
@
@
@




Join us on Telegram: https://t.me/matlabcastor
Join us on Facebook Group: https://www.facebook.com/groups/matlabcodes

No comments

Popular Posts

Followers