Strona główna > Funkcja > Max, min, średnia w tablicy

Max, min, średnia w tablicy

9 Grudzień 2010 Dodaj komentarz Go to comments
//element max, min i srednia w tablicy C
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
  int i, n, max, min;
  int *tab;
  float suma=0.0, srednia;
  tab = malloc ( n * sizeof(int));
  printf("Ile liczb w tablicy? ");
  scanf("%d", &n);
  for(i=0; i<n; i++)
          printf("Podaj %d liczbe ", i+1);
          scanf("%d", &tab[i]);
  for(i=1; i<n; i++)
          if(tab[i]<min) min=tab[i];
          else if (tab[i]>max) max=tab[i];
  for(i=0; i<n; i++)
  printf("Max %d \n", max);
  printf("Min %d \n", min);
  printf("Srednia %.2f \n", srednia);
  return 0;


  1. 17 Wrzesień 2013 o 12:25 pm

    Wonderful site. Lots of useful info here. I am sending
    it to several buddies ans also sharing in delicious. And
    naturally, thanks to your sweat!

  2. 9 Wrzesień 2015 o 10:25 am

    Excellent beat ! I wish to apprentice whilst you amend your web site, how can i subscribe for
    a weblog website? The account helped me a appropriate
    deal. I had been tiny bit acquainted of this your broadcast offered bright
    transparent concept

  3. 18 Marzec 2016 o 5:20 pm

    At this moment I am ready to do my breakfast, once having
    my breakfast coming again to read other news.

  4. 22 Lipiec 2016 o 8:19 pm

    Simply ddesire to ssay your article is as astounding. The clearness in your put up is simply great and that i
    could suppose you are an expert in this subject.
    Fine along with your permission allow me to clutch
    your feed to keep updated with drawing close post. Thank you 1,000,000 and please continue the rewarding work.

  5. 9 Październik 2016 o 4:15 pm


  6. 8 Grudzień 2016 o 2:07 am

    Thanks for any other informative web site. The place else may just
    I get that type of info written in such a perfect method?
    I’ve a mission that I am just now working on, and I’ve been at the look
    out for such info.

  7. 15 Luty 2017 o 4:32 pm


  8. 27 Luty 2017 o 10:53 am


  9. 19 Marzec 2017 o 11:49 pm


  10. 22 Marzec 2017 o 9:47 pm


  1. No trackbacks yet.


Wprowadź swoje dane lub kliknij jedną z tych ikon, aby się zalogować:


Komentujesz korzystając z konta Log Out / Zmień )

Zdjęcie z Twittera

Komentujesz korzystając z konta Twitter. Log Out / Zmień )

Facebook photo

Komentujesz korzystając z konta Facebook. Log Out / Zmień )

Google+ photo

Komentujesz korzystając z konta Google+. Log Out / Zmień )

Connecting to %s

%d bloggers like this: