#include <stdio.h>
int is_hex_digit(char input)
{
if((input>='0'&&input<='9')||(input>='a'&&input<='z')||(input>='A'&&input<='F'))
{
return 1;
}
else
{
return 0;
}
}
int main(void)
{
char input;
printf("> ");
scanf(" %c",&input);
int output = is_hex_digit(input);
printf("%d",output);
return 0;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter