NALLAMUTHU GOUNDER MAHALINGAM COLLEGE
POLLACHI-642001
R.Rasigapriya
Bsc Computer Science(Ist Year)
7.EB bill calculator
#include <iostream>
int main()
{
int a,b,c,d,e,f;
std::cout<<"Enter
the units::";
std::cin>>a;
if(a>100)
{
b=a-100;
c=100*0;
}
d=b*2.25;
e=c+d;
std::cout<<"consumed
units\t"<<a<<std::endl;
std::cout<<"0-100"<<"\t\t"<<0<<std::endl;
std::cout<<"100-200"<<"\t\t"<<c<<std::endl;
std::cout<<"200-300"<<"\t\t"<<d<<std::endl;
std::cout<<"total"<<"\t\t"<<e<<std::endl;
std::cout<<"Enter the units::";
std::cin>>a;
if(a>200)
{
b=a-200;
c=100*2.25;
}
d=b*4.70;
e=(c+d);
std::cout<<"consumed units\t"<<a<<std::endl;
std::cout<<"0-100\t\t"<<0<<std::endl;
std::cout<<"100-200\t\t"<<c<<std::endl;
std::cout<<"200-300\t\t"<<d<<std::endl;
std::cout<<"total\t\t"<<e<<std::endl;
std::cout<<"Enter the Units";
std::cin>>a;
if(a>300)
{
b=a-200;
c=100*2.25;
}
d=b*4.70;
e=(c+d);
std::cout<<"consumed units"<<a<<std::endl;
std::cout<<"\t0-100\t\t"<<0<<std::endl;
std::cout<<"\t200-300\t\t"<<c<<std::endl;
std::cout<<"\t300-400\t\t"<<d<<std::endl;
std::cout<<"\ttotal\t\t"<<e<<std::endl;
return 0;
}
OUTPUT: