Advertisement
Guest User

10.c

a guest
Oct 18th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.42 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3.     #define N 10000
  4.  
  5. int main(){
  6.     int v[N];
  7.     int i, j, n, aux = 0;
  8.    
  9.     scanf("%d", &n);
  10.    
  11.     for(i=0; i<n; i++){
  12.         scanf("%d", &v[i]);
  13.     }
  14.    
  15.     for(i=0; i<n; i++){
  16.         if(v[n-1]== v[i]){
  17.             aux++;
  18.         }
  19.     }
  20.     printf("Nota %d, %d vezes\n", v[n-1], aux);
  21.  
  22.     aux = 0;
  23.     for(i=0; i<n; i++){    
  24.         if(v[i]>aux){
  25.             aux = v[i];
  26.             j = i;
  27.         }
  28.     }
  29.     printf("Nota %d, indice %d\n", aux, j);
  30.  
  31.     return 0;
  32. }
  33. ×
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement