Advertisement
Josif_tepe

Untitled

Nov 22nd, 2022
794
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(){
  5.     int n = 132;
  6.    
  7.     int najgolema_cifra = 0; // 3
  8.     while(n > 0) { // 0
  9.         int cifra = n % 10;  // 1
  10.         n /= 10;
  11.        
  12.         if(najgolema_cifra < cifra) {
  13.             najgolema_cifra = cifra;
  14.         }
  15.     }
  16.     printf("%d\n", najgolema_cifra);
  17.     return 0;
  18.  
  19. }
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement