A really simple program. I just want to turn an 'A' into an 'a', but output is giving me 'A'.
#include <stdio.h>
int main(void) {
putchar(lower('A'));
}
lower(a)
int a;
{
if ((a >= 65) && (a >= 90))
a = a + 32;
return a;
}
You messed up the second part of your if
condition. That should be a <= 90
.
Also, FYI, there is a C library function tolower
that does this already:
#include <ctype.h>
#include <stdio.h>
int main() {
putchar(tolower('A'));
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With