+ 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
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 ;)
+ 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