I'm working on a project where I need to categorize a given character. The issue that I'm having right now is that I've managed to have it categorize the character as either an uppercase or lowercase letter. However, the professor also requires that, if the given character is a digit, I have the program print out the square root of the function. I can't seem to perform the square root function properly with a digit stored as a character, and it keeps returning the wrong value Thank you in advance for your help.
#include <stdio.h>
#include <math.h>
if ((input >= '0') && input <= '9'){
float squareRoot = sqrt(input);
printf ("%c is a digit.\nThe square root of %c is %0.2lf", input, input, squareRoot);
}
return 0;
In this situation, input is stored as a character and I have included the math.h library.