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

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

Popular Posts