Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Exercise 2-10.
- * Rewrite the function lower, which converts upper case letters to lower case,
- * with a conditional expression instead of if-else.
- */
- #include <stdio.h>
- int lower(int c)
- {
- return ((c >= 'A' && c <= 'Z')?(c+'a'-'A'):c);
- }
- int
- main() {
- printf ("%c\n",lower('K'));
- }
Advertisement
Add Comment
Please, Sign In to add comment