+ 1

Write a C program to input character from user and check whether the character is uppercase or lowercase alphabet using if else

Please help guys..thank you

21st Nov 2018, 9:16 AM
Randy Gerald
Randy Gerald - avatar
2 Answers
+ 2
Getting ascii/utf char code help you to determine if char is upper or lower case, since you know that english alphabet is coded in between 65-90 (bounds included: 26 letters) for upper case, and 97-122 for lower case, so in binary representation 10xxxxx for upper case and 11xxxxx for lower case (the 5 less signifiant bits could store 32 value, so enough for the 26 non-accentuated english letters) : if you know that the char to be tested is necessarly a letter, you just need to check the 6th bit (from right to left) wich determine letter case... however, if your input can be any char, you need to also check that the char code is in a valid range for a letter ;)
21st Nov 2018, 1:20 PM
visph
visph - avatar
+ 1
I made it at beginning of C learning!! But it's long since I didn't continue to practise C!!đŸ˜„đŸ˜„ https://code.sololearn.com/cpzArfoj9O9j/?ref=app
21st Nov 2018, 11:30 AM
AL Araf
AL Araf - avatar