read.cash Log in
@MyHero more from that month

Coding 101: Vowel or Consonant I took a little break earlier to check my Facebook messages and Chat Groups (Messenger). There's a guy who asked a question about C programming. He already has a solution or answer however, he wants a simple program with 11-15 lines of code. I decided to assist and provided him just a little idea or hint using the if and else statement and or (||). Good to know, he understands what I mean and the code runs successfully. Here's the code on how to determine if the input letter is consonant or vowel. It must be able to handle both small and capital letters. Note: input only letters #include<stdio.h> int main(){ //let for letter char let; printf("Enter an alphabet letter only: "); scanf("%c",&let); //if-else statement if(let =='a'||let=='A'||let=='e'||let=='E'||let=='i'||let=='I'||let=='o'||let=='O'||let=='u'||let=='U') //print if the letter is vowel printf("Letter %c is a vowel.",let); else //print if the letter is consonant printf("Letter %c is a consonant.",let); return 0; }

6 comments

Log in to join in Reading is open to everyone. Replying needs an account.