Advertisement
Josif_tepe

Untitled

Nov 23rd, 2022
881
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 x = 345;
  6.    
  7.     int najgolema_cifra = 0; // 5
  8.     while(x > 0) { // 3
  9.         int cifra = x % 10; // 3
  10.         x /= 10;
  11.        
  12.         if(cifra > najgolema_cifra) {
  13.             najgolema_cifra = cifra;
  14.         }
  15.     }
  16.    
  17.     printf("%d\n", najgolema_cifra);
  18.     return 0;
  19.  
  20. }
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement