Search This Blog

#Day69 #100DaysChallenge- Matlab Loops| Alphabet or Not

#Day69-Alphabet or Not

Task:

Write a code to find given character is alphabet or not
'a'-Alphabet
66-Alphabet(ASCII VALUE)
'*'-Not an alphabet


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

Matlab code


function alphabetornot(x)
if (x>='A' && x<='Z')||(x>='a'&& x<='z')
    fprintf('The character you entered is alphabet');
   
else
    fprintf('The character is not an alphabet');
end
end
Sample Input and Output
alphabetornot(66)
The character you entered is alphabet>> alphabetornot(6)
The character is not an alphabet>> alphabetornot('6')
The character is not an alphabet>> alphabetornot('b')
The character you entered is alphabet>> alphabetornot('8')
The character is not an alphabet


Click here for video description











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); })();