#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
'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
Free Codes: youtube.com/castorclasses
No comments