Search This Blog

#Day65 #100DaysChallenge- Matlab Loops| Printing Alphabet

#Day65-Printing Alphabet

Task:

Write a code to print alphabets in given range

Start Character:g Stop Character:p

g h i j k l m n o p

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

Matlab code 

function printingalphabet(n,m)
for i=n:1:m
    fprintf('%c',i);
    fprintf('\t');
end

Sample Input and Output
>> printingalphabet('a')
a b c d e f g h i j k l m n o p q r s t u v w x y z
>> printingalphabet('f')
f g h i j k l m n o p q r s t u v w x y z >> printingalphabet('s')
s t u v w x y z >> printingalphabet('s','y')
s t u v w x y >> printingalphabet('g','p')
g h i j k l m n o p

Click here for video description


Live Support: t.me/matlabirawen




No comments

'; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })();