Created
November 8, 2022 05:43
-
-
Save max-programming/8ef1811d8111ddde05aeeccb096741fe to your computer and use it in GitHub Desktop.
Last Question in C Exam Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int is_alphabet(char letter) | |
{ | |
if (letter >= 'a' && letter <= 'z') return 1; | |
if (letter >= 'A' && letter <= 'Z') return 1; | |
return 0; | |
// we don't need else because we are returning | |
} | |
int main() | |
{ | |
char letter; | |
printf("Enter a character: "); | |
scanf("%c", &letter); | |
if (is_alphabet(letter)) | |
printf("It's an alphabet"); | |
else | |
printf("It's not an alphabet"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment