Josif_tepe

Untitled

May 7th, 2026
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.    
  5.     int n;
  6.     scanf("%d", &n);
  7.    
  8.    
  9.     float niza[n];
  10.     for(int i = 0; i < n; i++) {
  11.         scanf("%f", &niza[i]);
  12.     }
  13.    
  14.     float zbir = 0.0;
  15.     for(int i = 0; i < n; i++) {
  16.         zbir += niza[i];
  17.     }
  18.    
  19.     zbir /= n;
  20.    
  21.     printf("Sredna vrednost %f\n", zbir);
  22.    
  23.     float najmal_broj = niza[0];
  24.     int indeks = 0;
  25.    
  26.     for(int i = 0; i < n; i++) {
  27.         if(niza[i] < najmal_broj) {
  28.             najmal_broj = niza[i];
  29.             indeks = i;
  30.         }
  31.     }
  32.    
  33.     printf("Najmal element e %f so indeks %d\n", najmal_broj, indeks);
  34.     return 0;
  35. }
  36.  
  37.  
  38.  
Advertisement
Add Comment
Please, Sign In to add comment