Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C Compiler.
- Code, Compile, Run and Debug C program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <stdio.h>
- int wartosc_max=0;
- int wystepowanie_maxa=0;
- int j=0;
- int tab[]={9,6,3,87,9,4,2,5,87,5,4,87,23,0};
- int main()
- {
- while(tab[j]!=0){
- if(tab[j]>wartosc_max){
- wartosc_max=tab[j];
- wystepowanie_maxa=0;
- }
- if(tab[j]==wartosc_max){
- wystepowanie_maxa++;
- }
- /* printf("wczytalem sobie liczbe= %i\n",tab[j]);
- printf("j = %i\nnajwyzsza= %i\nwystepowanie= %i\n",j,wartosc_max,wystepowanie_maxa);
- */
- j++;
- }
- printf("najwyzsza wartoscia bylo: %i \nwystapila %i razy \n",wartosc_max,wystepowanie_maxa);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement