Advertisement
Josif_tepe

Untitled

May 27th, 2021
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int main() {
  6.     int n;
  7.     while (scanf("%d", &n)) {
  8.         int najgolema_cifra = -2000000000;
  9.         while(n > 0) {
  10.             int cifra = n % 10;
  11.             if(najgolema_cifra < cifra) {
  12.                 najgolema_cifra = cifra;
  13.             }
  14.             n /= 10;
  15.         }
  16.         printf("%d\n", najgolema_cifra);
  17.     }
  18.    
  19.    
  20.     return 0;
  21. }
  22. /*
  23.  
  24.  
  25.  5 : 5
  26.  4958 : 26
  27.  8 : 8
  28.  99999 : 45
  29.  654 : 15
  30.  475869 : 39
  31.  6 : 6
  32.  99 : 18
  33.  85 : 13
  34.  96 : 15
  35.  **/
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement