#Day68 #100DaysChallenge- Matlab Loops| Vowels or Consonant
#Day68-Vowels Or Consonant
Task:
Write a code to find given character is vowels or Consonant
a,e,i,o,u-Vowels
a,e,i,o,u-Vowels
C,b,n,m-Consonant
Note: This code can be done using the in-built command. But for the challenge, I am trying to avoid those.
Matlab code
function vowelornot(c)
if c=='a'||c=='e'||c=='i'||c=='o'||c=='u'||c=='A'||c=='E'||c=='I'||c=='O'||c=='U'
fprintf('The
given character is vowel');
fprintf('\n');
fprintf('***************************');
else
fprintf('The
given character is consonant');
fprintf('\n');
fprintf('*********************************');
end
>> vowelornot('c')
The given character is consonant
*********************************>> vowelornot('e')
The given character is vowel
***************************>> vowelornot('i')
The given character is vowel
***************************>> vowelornot('l')
The given character is consonant
*********************************>>
Free Codes: youtube.com/castorclasses
No comments