[Ex1 - Q2] Ajout
This commit is contained in:
parent
0c458c5329
commit
16d08a4592
55
README.md
55
README.md
@ -14,3 +14,58 @@ densite = population / surface;
|
||||
- Surface terrestre mondiale : 133 950 670 km2
|
||||
- Nombre d'habitants mondial : 7 534 720 000 habitants
|
||||
- Densité moyenne : 56.25 habitants/km²
|
||||
|
||||
## Question 2
|
||||
> Calculer la surface terrestre, le nombre d’habitants et la densité moyenne d’habitants au km2 pour chaque continent.
|
||||
|
||||
**[Script Scilab](resources/scripts/ex1-2.sce) :**
|
||||
```scilab
|
||||
surfaceAfrique = sum(data(1:57, 2)* 1000);
|
||||
populationAfrique = sum(data(1:57, 3)* 1000000);
|
||||
densiteAfrique = populationAfrique / surfaceAfrique;
|
||||
|
||||
surfaceAmeriqueDuNord = sum(data(58:86, 2)* 1000);
|
||||
populationAmeriqueDuNord = sum(data(58:86, 3)* 1000000);
|
||||
densiteAmeriqueDuNord = populationAmeriqueDuNord / surfaceAmeriqueDuNord;
|
||||
|
||||
surfaceAmeriqueDuSud = sum(data(87:99, 2)* 1000);
|
||||
populationAmeriqueDuSud = sum(data(87:99, 3)* 1000000);
|
||||
densiteAmeriqueDuSud = populationAmeriqueDuSud / surfaceAmeriqueDuSud;
|
||||
|
||||
surfaceAsie = sum(data(100:150, 2)* 1000);
|
||||
populationAsie = sum(data(100:150, 3)* 1000000);
|
||||
densiteAsie = populationAsie / surfaceAsie;
|
||||
|
||||
surfaceEurope = sum(data(151:193, 2)* 1000);
|
||||
populationEurope = sum(data(151:193, 3)* 1000000);
|
||||
densiteEurope = populationEurope / surfaceEurope;
|
||||
|
||||
surfaceOceanie = sum(data(194:207, 2)* 1000);
|
||||
populationOceanie = sum(data(194:207, 3)* 1000000);
|
||||
densiteOceanie = populationOceanie / surfaceOceanie;
|
||||
```
|
||||
**Résultat :**
|
||||
|
||||
- Surface terrestre :
|
||||
- Afrique : 30 312 530 km²
|
||||
- Amérique du nord : 22 314 070 km²
|
||||
- Amérique du sud : 17 821 000 km²
|
||||
- Asie : 31 879 830 km²
|
||||
- Europe : 23 060 610 km²
|
||||
- Océanie : 8 562 630 km²
|
||||
|
||||
- Population :
|
||||
- Afrique : 1 250 700 000 habitants
|
||||
- Amérique du nord : 581 880 000 habitants
|
||||
- Amérique du sud : 422 980 000 habitants
|
||||
- Asie : 199 082 704 habitants
|
||||
- Europe : 744 330 000 habitants
|
||||
- Océanie : 40 780 000 habitants
|
||||
|
||||
- Densité moyenne :
|
||||
- Afrique : 41.26 habitants/km²
|
||||
- Amérique du nord : 26.08 habitants/km²
|
||||
- Amérique du sud : 23.73 habitants/km²
|
||||
- Asie : 140.97 habitants/km²
|
||||
- Europe : 32.28 habitants/km²
|
||||
- Océanie : 4.76 habitants/km²
|
||||
|
49
resources/scripts/ex1-2.sce
Normal file
49
resources/scripts/ex1-2.sce
Normal file
@ -0,0 +1,49 @@
|
||||
data = csvRead("resources/data/data.csv");
|
||||
|
||||
surfaceAfrique = sum(data(1:57, 2)* 1000);
|
||||
populationAfrique = sum(data(1:57, 3)* 1000000);
|
||||
densiteAfrique = populationAfrique / surfaceAfrique;
|
||||
|
||||
surfaceAmeriqueDuNord = sum(data(58:86, 2)* 1000);
|
||||
populationAmeriqueDuNord = sum(data(58:86, 3)* 1000000);
|
||||
densiteAmeriqueDuNord = populationAmeriqueDuNord / surfaceAmeriqueDuNord;
|
||||
|
||||
surfaceAmeriqueDuSud = sum(data(87:99, 2)* 1000);
|
||||
populationAmeriqueDuSud = sum(data(87:99, 3)* 1000000);
|
||||
densiteAmeriqueDuSud = populationAmeriqueDuSud / surfaceAmeriqueDuSud;
|
||||
|
||||
surfaceAsie = sum(data(100:150, 2)* 1000);
|
||||
populationAsie = sum(data(100:150, 3)* 1000000);
|
||||
densiteAsie = populationAsie / surfaceAsie;
|
||||
|
||||
surfaceEurope = sum(data(151:193, 2)* 1000);
|
||||
populationEurope = sum(data(151:193, 3)* 1000000);
|
||||
densiteEurope = populationEurope / surfaceEurope;
|
||||
|
||||
surfaceOceanie = sum(data(194:207, 2)* 1000);
|
||||
populationOceanie = sum(data(194:207, 3)* 1000000);
|
||||
densiteOceanie = populationOceanie / surfaceOceanie;
|
||||
|
||||
mprintf("Surface terrestre :\n");
|
||||
mprintf("\t• Afrique : %d km²\n", surfaceAfrique);
|
||||
mprintf("\t• Amérique du nord : %d km²\n", surfaceAmeriqueDuNord);
|
||||
mprintf("\t• Amérique du sud : %d km²\n", surfaceAmeriqueDuSud);
|
||||
mprintf("\t• Asie : %d km²\n", surfaceAsie);
|
||||
mprintf("\t• Europe : %d km²\n", surfaceEurope);
|
||||
mprintf("\t• Océanie : %d km²\n", surfaceOceanie);
|
||||
|
||||
mprintf("Population :\n");
|
||||
mprintf("\t• Afrique : %d habitants\n", populationAfrique);
|
||||
mprintf("\t• Amérique du nord : %d habitants\n", populationAmeriqueDuNord);
|
||||
mprintf("\t• Amérique du sud : %d habitants\n", populationAmeriqueDuSud);
|
||||
mprintf("\t• Asie : %d habitants\n", populationAsie);
|
||||
mprintf("\t• Europe : %d habitants\n", populationEurope);
|
||||
mprintf("\t• Océanie : %d habitants\n", populationOceanie);
|
||||
|
||||
mprintf("Densité moyenne :\n");
|
||||
mprintf("\t• Afrique : %.2f habitants/km²\n", densiteAfrique);
|
||||
mprintf("\t• Amérique du nord : %.2f habitants/km²\n", densiteAmeriqueDuNord);
|
||||
mprintf("\t• Amérique du sud : %.2f habitants/km²\n", densiteAmeriqueDuSud);
|
||||
mprintf("\t• Asie : %.2f habitants/km²\n", densiteAsie);
|
||||
mprintf("\t• Europe : %.2f habitants/km²\n", densiteEurope);
|
||||
mprintf("\t• Océanie : %.2f habitants/km²\n", densiteOceanie);
|
Loading…
Reference in New Issue
Block a user