karlangadas

5 Fuerza Bruta

Jan 15th, 2017
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4.     int arr[10]={4,2,7,1,7,3,9,5,8,7};
  5.     int cant=10,max=0,num=7,ans=0;
  6.     for (int i=0;i<cant;i++){
  7.         if (arr[i]>max)
  8.             max=arr[i];
  9.        
  10.         if (arr[i]==7)
  11.             ans++;
  12.     }
  13.     printf("El máximo número es: %d y el %d se repite %d veces\n",max,num,ans);
  14.     return 0;
  15. }
Advertisement
Add Comment
Please, Sign In to add comment