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

Search This Blog

#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
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

Sample Input and Output
>> 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
*********************************>> 

Click here for video description




Live Support: t.me/matlabirawen



No comments

Popular Posts

Followers