Advertisement
Primitiv0

KPG & Fuel Cost

Sep 10th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6.  
  7. {
  8.     float consumo,rendimiento,precio,galones,kms;
  9.    
  10.     cout <<"Consumo y rendimiento de gasolina de un vehículo \n";
  11.    
  12.     cout<<"Ingrese los galones consumidos"<<endl;
  13.     cin>>galones;
  14.     cout<<"Ingrese los kilómetros recorridos"<<endl;
  15.     cin>>kms;
  16.     precio = 249.50;
  17.     consumo=(double)(precio*galones);
  18.     rendimiento=(double)(kms/galones);
  19.    
  20.     cout<<"Registro consumo gasolina"<<endl;
  21.     cout<<"----------------------------------------------"<<endl;
  22.     cout<<"Precio gasolina: "<<precio<<endl;
  23.     cout<<"                                              "<<endl;
  24.     cout<<"Cantidad de galones: "<<galones<<endl;
  25.     cout<<"kilómetros recorridos: "<<kms<<endl;
  26.     cout<<"----------------------------------------------"<<endl;
  27.     cout<<"Total consumido RD$: "<<consumo<<endl;
  28.     cout<<"Rendimiento en Km/Galón: "<<rendimiento<<endl;
  29.    
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement