Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<string.h>
- int main()
- {
- char s[25];
- scanf("%s", s);
- int i, n = strlen(s);
- if(s[0] == '-')
- {
- if(n == 3 && s[2] == '0')
- {
- printf("0\n");
- }
- else
- {
- for(i = 0; i <= n - 3; i++) printf("%c", s[i]);
- if(s[n - 1] > s[n - 2]) printf("%c\n", s[n - 2]);
- else printf("%c\n", s[n - 1]);
- }
- }
- else for(i = 0; i < n; i++) printf("%c", s[i]);
- }
Advertisement
Add Comment
Please, Sign In to add comment