Lesson 6 of 23

&&, ||, ! மற்றும் switch&&, ||, ! and switch

9 min 25 XP

&& (AND) இரண்டும் true ஆனால் true; || (OR) ஏதேனும் ஒன்று true ஆனால் true; ! (NOT) மாற்றும். ternary operator: condition ? a : b.

&& (AND) is true when both sides are true, || (OR) when either is, and ! (NOT) flips a condition. The ternary operator condition ? a : b picks one of two values.

Example: edit me and press Run

Output Loading C (first time takes a few seconds)
Press Run to see the result here.

switch ஒரு மதிப்பைப் பல case-களுடன் ஒப்பிடும். ஒவ்வொரு case முடிவிலும் break வேண்டும், இல்லையெனில் அடுத்த case-ம் இயங்கும் (fall-through).

switch compares one value against many cases. End each case with break, or execution falls through into the next case.

Example: edit me and press Run

Output Loading C (first time takes a few seconds)
Press Run to see the result here.

Challenge

+25 XP

ஒரு எழுத்தைப் படித்து (scanf(" %c", &ch)), அது vowel (a e i o u, small அல்லது capital) ஆனால் "Vowel", இல்லையெனில் "Consonant" என்று print செய்யுங்கள். switch பயன்படுத்துங்கள்.

Read a letter with scanf(" %c", &ch). Print "Vowel" for a, e, i, o, u (small or capital), otherwise "Consonant". Use switch.

Output Loading C (first time takes a few seconds)
Press Run to see the result here.