From 5f5a41ff0061f6e74c46de2d10c250105a8a922b Mon Sep 17 00:00:00 2001 From: Lyanis Souidi Date: Wed, 3 May 2023 23:19:47 +0200 Subject: [PATCH] Ajout Ex1 - Question 1 --- README.md | 16 ++++++++++++++++ resources/scripts/ex1-1.sce | 7 +++++++ 2 files changed, 23 insertions(+) create mode 100644 resources/scripts/ex1-1.sce diff --git a/README.md b/README.md index 7242674..9b8f236 100644 --- a/README.md +++ b/README.md @@ -1 +1,17 @@ # SAÉ S2.04 (visualisation de données) + +## Exercice 1 +### Question 1 +> Calculer la surface terrestre mondiale, le nombre d’habitants mondial et la densité moyenne d’habitants au km2. + +[Script Scilab](resources/scripts/ex1-1.sce) : +```scilab +data = csvRead("resources/data/data.csv"); +surface = sum(data(:, 2)*1000); +population = sum(data(:, 3)*1000000); +densite = population / surface; +``` +Résultat : +- Surface terrestre mondiale : 133 950 670 km2 +- Nombre d'habitants mondial : 7 534 720 000 habitants +- Densité moyenne : 56,25 habitants/km² diff --git a/resources/scripts/ex1-1.sce b/resources/scripts/ex1-1.sce new file mode 100644 index 0000000..70928f5 --- /dev/null +++ b/resources/scripts/ex1-1.sce @@ -0,0 +1,7 @@ +data = csvRead("resources/data/data.csv"); +surface = sum(data(:, 2)*1000); +population = sum(data(:, 3)*1000000); +densite = population / surface; +mprintf("Surface terrestre mondiale : %d km²\n", surface); +mprintf("Nombre d''habitants mondial : %.0f habitants\n", population); +mprintf("Densité moyenne : %.0f habitants/km²\n", densite);