Write a C++ program that will prompt the user to enter the current rates of electricity, gas and petrol per unit. Give each item's rate and increment of 10% . Compute and display the prices per unit of electricity, gas, and petrol.



#include<iostream>

using namespace std;

int main()

{

int e1, e2, g1, g2, p1, p2;

cout<<"Enter current Electricity rate: ";

cin>>e1;

cout<<"Enter current Petrol rate: ";

cin>>p1;

cout<<"Enter current Gas rate: ";

cin>>g1;

e2 = e1 * 1.1;

p2 = p1 * 1.1;

g2 = g1 * 1.1;

cout<<"New Electricity rate: "<<e2<<endl;

cout<<"New Petrol rate: "<<p2<<endl;

cout<<"New Gas rate: "<<g2<<endl;

}

OUTPUT

Enter current Electricity rate: 23

Enter current Petrol rate: 9

Enter current Gas rate: 66

New Electricity rate: 25

New Petrol rate: 9

New Gas rate: 72


1 comment: