Académique Documents
Professionnel Documents
Culture Documents
<script>
function permutation(a, b, c) {
console.log("A =", a);
console.log("B =", b);
console.log("C =", c);
}
function variables() {
var A = parseInt(prompt("Entrez la valeur de A :"));
var B = parseInt(prompt("Entrez la valeur de B :"));
var C = parseInt(prompt("Entrez la valeur de C :"));
permutation(A, B, C);
}
variables();
</script>
Exercice 2 :
<script>
function calculerDistance(x1, y1, x2, y2) {
let distance =
2));
Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1),
Exercice 3 :
<script>
function temps(secondes) {
var heures = Math.floor(secondes / 3600);
var minutes = Math.floor((secondes % 3600) / 60);
//J'ai utiliser la fonction Math.floor() pour arrondir vers le bas pour avoir un nombre entier
var reste = secondes % 60;
return heures + ":" + minutes + ":" + reste;
}
var secondes = 25300;
var tempsConverti = temps(secondes);
console.log("Le tamps est :", tempsConverti);
</script>
Exercice 4 :
<script>
// la circonférence du cercle
function calculerCirconference(rayon) {
return 2 * Math.PI * rayon;
}
// la surface du cercle
function calculerSurfaceCercle(rayon) {
return Math.PI * rayon * rayon;
}
//la surface de sphère
function calculerSurfaceSphere(rayon) {
return 4 * Math.PI * rayon * rayon;
}
// le volume de sphère
function calculerVolumeSphere(rayon) {
return (4 / 3) * Math.PI * Math.pow(rayon, 3);
}
var rayon = parseInt(prompt("Entrez la valeur de rayon :"));
var circonference = calculerCirconference(rayon);
var surfaceCercle = calculerSurfaceCercle(rayon);
var surfaceSphere = calculerSurfaceSphere(rayon);
var volumeSphere = calculerVolumeSphere(rayon);
console.log("le cercle de rayon", rayon, ":"); console.log("Circonférence:", circonference.toFixed(2));
console.log("Surface:", surfaceCercle.toFixed(2));
console.log("la sphère de rayon", rayon, ":");
console.log("Surface:", surfaceSphere.toFixed(2));
console.log("Volume:", volumeSphere.toFixed(2));
</script>