glx_56de37973380417c75c17f999823807b.txt exo 7 corriges en algorithme https://keidweneth.com/ilrRUQJCUIw6T/60695
الصفحة الرئيسية

exo 7 corriges en algorithme

 

Écrire un programme   qui demande deux nombres m et n à l’utilisateur et l’informe ensuite si le produit de ces deux nombres est positif ou négatif. On inclut dans le programme le cas où le produit peut être nul.

******** En Algorithme ********

Algorithme Variables m,n:réels Debut Ecrire(" Entrer un nombre:") Lire(m) Ecrire(" Entrer un nombre:") Lire(n) Si( n == 0 ou m == 0) alors Ecrire("Le produit est nul!!") FinSi Si( m*n < 0) alors Ecrire("Le produit est négatif") FinSi Si( m*n > 0) alors Ecrire("Le produit est positif") FinSi Fin Résultat ==> Entrer un nombre: -7.4 Entrer un nombre: 2 Le produit est négatif

Retour vers la liste d'exercices

******** En C ********

#include <stdio.h> int main() { float m,n ; printf(" Entrer un nombre:"); scanf("%f",&m); printf(" Entrer un nombre:"); scanf("%f",&n); if( n == 0 || m == 0) printf("le produit est nul!!"); if ( m*n < 0) printf("le produit est negatif" ); if ( m*n > 0) printf("le produit est positif" ); return 0; }

Retour vers la liste d'exercices

******** En C++ ********

#include <iostream> using namespace std; int main() { float m,n ; cout<<" Entrer un nombre:"; cin>>m; cout<<" Entrer un nombre:"; cin>>n; if( n == 0 || m == 0) cout<<"Le produit est nul!!"; if ( m*n < 0) cout<<"Le produit est negatif"; if ( m*n > 0) cout<<"Le produit est positif"; return 0; }

******** En Python ********

A = float(input("Entrer un Entier A:")) B = float(input("Entrer un Entier B:")) if A*B < 0 : print("Le produit de",A,"et",B,"est négatif") elif A*B > 0: print("Le produit de",A,"et",B,"est positif") else : print("Le produit de",A,"et",B,"est nul ")

الاسمبريد إلكترونيرسالة