answersLogoWhite

0


Best Answer

#include<iostream>

using namespace std;

#include<conio.h>

void main()

{

char m[100];

int units[100],i,j,n;

float x,tb;

cout<<"enter the total number of bills to be calculate:\n";

cin>>n;

for(i=1;i<=n;i++)

{

cout<<"\nenter the name \n:==>";

cin>>m;

for(i=0;i<n;i++)

{

cout<<"\nenter the total units consumed \n:==>";

cin>>units[i];

}

}

if(units[i]<=100)

{

x=units[i]*0.6;

tb=50+x;

if(tb>300)

{

tb=0.15*tb+tb;

}

cout<<"\ncalculated bill:==>";

cout<<m<<tb;

}

else if(units[i]>100 && units[i]<=300)

{

tb=100*0.6+(units[i]-100)*0.8+50;

if(tb>300)

{

tb=0.15*tb+tb;

}

cout<<"\ncalculated bill:==>";

cout<<m<<tb;

}

else if(units[i]>300)

{

tb=100*0.6+200*0.8+(units[i]-300)*0.9+50;

if(tb>300)

{

tb=0.15*tb+tb;

}

cout<<"\ncalculated bill:==>";

cout<<m<<tb;

}

getch();

}

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you calculate water bill from C programming?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is c program to calculate product of all even numbers from entered number down to 1?

c is programming laungage


What is c and c in computer programming?

C and C++ are both high-level programming languages.


Create a spiral in C programming?

create spiral in c programming?


Calculate the value of sigma from the infinite series in C programming?

Not possible, summing an infinite series would take infinite time.


What has the author Robert Lafore written?

Robert Lafore has written: 'Object-oriented programming in Microsoft C++' -- subject(s): Object-oriented programming (Computer science), C++ (Computer program language), C. 'Microsoft C. Programming for the I.B.M.Personal Computer' 'Object-oriented programming in C++' 'Windows Programming Made Ridiculously Easy Book' 'The Waite Group's C Programming Using Turbo C++ (The Waite Group)' 'Microsoft C programming for the IBM' 'The Waite Group's Microsoft C programming for the PC' -- subject(s): C (Computer program language), IBM microcomputers, Microsoft C (Computer program), Microsoft C., Programming


When was C - programming language - created?

C - programming language - was created in 1972.


What is a C compiler as used in C programming?

In C programming, C compiler is user to translate C source into C object module.


What is the benefit of the C programming languages?

C language is better for hardware programming .Most of the programming for hardware are written in C language so it is beneficial for hardware programming is not efficient for application programming due to drawback like in C data moves around the system.


Name of object oriented programming language?

C++ is the name of a programming language.


Where can one find C programming tutorials?

You can find C programming tutorials online at the C programming website. They provide both free and paid tutorials for many aspects of the C and C++ code.


Who wrote the c?

The C shell was originally written by Bill Joy (of vi fame).


Websites to download c C programming language books?

Download 1000s of C C C++ Programming Language. http://www.guruengineers.com