Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- struct kraj
- {
- char nazwa [40];
- float powierzchnia;
- int ludnosc;
- };
- double zageszczenie(struct kraj tab[],int n)
- {
- int i=0;
- double zageszczenie;
- double min=(tab[i+1].ludnosc/tab[i+1].powierzchnia);
- for (i=0;i<n;i++)
- min=(tab[i+1].ludnosc/tab[i+1].powierzchnia);
- if(zageszczenie<min)
- {
- min=zageszczenie;
- }
- return min;
- }
- int main()
- {
- struct kraj kr[3]={{"Ameryka",178,320},{"Ameryka2",102,323},{"Ameryka3",154,280}};
- printf("%2lf",zageszczenie(kr,3));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement