القائمة الرئيسية

الصفحات







Corrigée d’exercice 7



******** 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 l’exercice

 



*******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 l’exercice

 



******** 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;

}



 

Retour vers l’exercice

 



 

 

  

هل اعجبك الموضوع :

تعليقات