Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.97 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3.                             Online C Compiler.
  4.                 Code, Compile, Run and Debug C program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <stdio.h>
  10. int wartosc_max=0;
  11. int wystepowanie_maxa=0;
  12. int j=0;
  13.  
  14. int tab[]={9,6,3,87,9,4,2,5,87,5,4,87,23,0};
  15.  
  16.  
  17. int main()
  18. {
  19.    
  20.     while(tab[j]!=0){
  21.         if(tab[j]>wartosc_max){
  22.             wartosc_max=tab[j];
  23.             wystepowanie_maxa=0;
  24.             }
  25.        if(tab[j]==wartosc_max){
  26.             wystepowanie_maxa++;
  27.             }
  28. /*  printf("wczytalem sobie liczbe= %i\n",tab[j]);
  29.     printf("j = %i\nnajwyzsza= %i\nwystepowanie= %i\n",j,wartosc_max,wystepowanie_maxa);
  30. */    
  31.     j++;
  32.     }
  33.    
  34.     printf("najwyzsza wartoscia bylo: %i \nwystapila %i razy \n",wartosc_max,wystepowanie_maxa);
  35.  
  36.     return 0;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement