Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <ctype.h>
- int func1(char);
- int main()
- {
- char ch;
- int result;
- while((ch = getchar())!= EOF)
- {
- result =func1(ch);
- printf("result is %d\n",result);
- }
- return 0;
- }
- int func1(char c)
- {
- int res;
- if(islower(c))
- {
- res = c - 'a'+1;
- }
- else if(isupper(c))
- {
- res = c - 'A'+1;
- }
- else
- res = -1;
- return res;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement