Advertisement
Guest User

Untitled

a guest
May 25th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.59 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. struct kraj
  5. {
  6.     char nazwa [40];
  7.     float powierzchnia;
  8.     int ludnosc;
  9. };
  10.  
  11. double zageszczenie(struct kraj tab[],int n)
  12. {
  13.     int i=0;
  14.     double zageszczenie;
  15.     double min=(tab[i+1].ludnosc/tab[i+1].powierzchnia);
  16.     for (i=0;i<n;i++)
  17.         min=(tab[i+1].ludnosc/tab[i+1].powierzchnia);
  18.     if(zageszczenie<min)
  19.     {
  20.         min=zageszczenie;
  21.     }
  22.     return min;
  23. }
  24.  
  25. int main()
  26. {
  27.     struct kraj kr[3]={{"Ameryka",178,320},{"Ameryka2",102,323},{"Ameryka3",154,280}};
  28.     printf("%2lf",zageszczenie(kr,3));
  29.  
  30.  
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement