fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. #define pagio 10.00
  4. using namespace std;
  5. int main(){
  6. float kwh,cost,teliko,per;
  7. cout<<"δωσε kwh";
  8. cin>>kwh;
  9. if(kwh>=0 && kwh<=100){
  10. cost=kwh*0.12;
  11.  
  12. }
  13.  
  14. else if(kwh>=101&& kwh<=300){
  15. cost=100*0.12+(kwh-100)*0.15;
  16.  
  17. }
  18.  
  19. else if(kwh>=301&&kwh<=600){
  20. cost=100*0.12+200*0.15+(kwh-300)*0.20;
  21.  
  22. }
  23.  
  24. else {
  25. cost=100*0.12+200*0.15+300*0.20+(kwh-600)*0.28;
  26.  
  27. }
  28.  
  29. cout<<"kostos energias"<<fixed<<setprecision(2)<<cost<<endl;
  30.  
  31. teliko=cost+pagio;
  32.  
  33.  
  34.  
  35. if(kwh>500){
  36. per=teliko*0.05;
  37. teliko=cost+per+pagio;
  38. cout<<"perivallontiko telos"<<fixed<<setprecision(2)<<per<<endl;
  39.  
  40.  
  41. }
  42. cout<<"teliko poso"<<fixed<<setprecision(2)<<teliko<<endl;
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82. return 0;
  83. }
Success #stdin #stdout 0s 544KB
stdin
650
stdout
δωσε kwhkostos energias116.00
perivallontiko telos6.30
teliko poso132.30