Recherche personnalisée

Ex1_6



C++BuilderX - Ex1_6.c

Ex1_6.c
Créé avec C++BuilderX
#include <stdio.h>
void main()
{
  const float PU1 = 0.8420;
  const float PU2 = 0.9055;
  const float PU3 = 0.9851;
  const float PU4 = 1.3464;
  const float FFixes = 1.808;
  float AIndice, NIndice, consommation;
  float montant = FFixes; // Montant à payer.

  printf( "Donnez la valeur de l'ancien indice\n : " );
  scanf( "%f", & AIndice );
  printf( "Donnez la valeur du nouvel indice\n : " );
  scanf( "%f", & NIndice );
  consommation = NIndice - AIndice;
  // calcul du montant à régler
  if ( consommation > 300 )
  {
    montant +=   PU4 * (consommation-300);
	 consomation=300;
  }
  if ( consommation > 200 )
  {
    montant +=   PU3 * ( consommation - 200 );
	 consomation=200;
  }
  if ( consommation > 100 )
  {
    montant +=   PU2 * ( consommation - 100 );
    consomation=100;

  }
 
  
    montant += PU1 * consommation  ;
    montant *= 1.2;
  

  printf( "Le montant à règler est:%f\n", montant );
}





Ex1_6.c
Créé avec C++BuilderX

calle
calle
calle

Suivre la vie de ce site RSS -
HitMaroc.net
Formation GoogleCe site est listé dans la catégorie Informatique : Programmation informatique Dictionnaire