Advertisement
Guest User

Untitled

a guest
May 20th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. #include <stdio.h>
  2. #define N 7
  3.  
  4. int massimo(int v[]);
  5.  
  6. int main (void)
  7. {
  8.     int vet[N],mass,i;
  9.  
  10.     srand(time(0));
  11.  
  12.     for(i=0;i<N;i++)
  13.     {
  14.         vet[i]=(rand()%24)+2;
  15.         printf("%d\t",vet[i]);
  16.     }
  17.  
  18.     mass=massimo(vet);
  19.     printf("\n%d",mass);
  20.  
  21. }
  22. int massimo (int v[])
  23. {
  24.     int max=0,i;
  25.  
  26.     for(i=0;i<N;i++){
  27.         if(v[i]>max){
  28.             max=v[i];
  29.         }
  30.     }
  31.  
  32.     return max;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement