Advertisement
Josif_tepe

Untitled

Nov 19th, 2023
540
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.54 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3.  
  4. int main (int argc, const char * argv[]) {
  5.    
  6.    
  7.     int n;
  8.     scanf("%d", &n);
  9.    
  10.     int zbir = 0;
  11.     int broj_na_cifri = 0;
  12.     for(int x = n; x > 0; x /= 10) {
  13.         int cifra = x % 10;
  14.        
  15.         zbir += cifra;
  16.         broj_na_cifri++;
  17.     }
  18.    
  19.     int sredna_vrednost = zbir / broj_na_cifri;
  20.    
  21.     for(int y = n; y > 0; y /= 10) {
  22.         int cifra = y % 10;
  23.        
  24.         if(cifra > sredna_vrednost) {
  25.             printf("%d ", cifra);
  26.         }
  27.     }
  28.  
  29. return 0;
  30.  
  31. }
  32.  
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement