Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main() {
- int n;
- while (scanf("%d", &n)) {
- int najgolema_cifra = -2000000000;
- while(n > 0) {
- int cifra = n % 10;
- if(najgolema_cifra < cifra) {
- najgolema_cifra = cifra;
- }
- n /= 10;
- }
- printf("%d\n", najgolema_cifra);
- }
- return 0;
- }
- /*
- 5 : 5
- 4958 : 26
- 8 : 8
- 99999 : 45
- 654 : 15
- 475869 : 39
- 6 : 6
- 99 : 18
- 85 : 13
- 96 : 15
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement