The Electricity board charges according to the following rates:
For the first 100 units – 40 P per unit ( P -> Paise)
For the next 200 units – 50 P per unit
Beyond 300 units – 60 P per unit
All users are charged meter charge also which is Rs. 50/-
void main()
{
int unit;
float charge;
cout << “\n Enter the no. of units , Electricity Consumed :”;
cin >> unit;
if (unit <= 100 )
charge = 50.0 + 0.4 * unit;
else if(unit<=300)
charge = 50.0 +4.0 * 100 + 0.5 * (unit – 100);
else
charge = 50.0 + 4.0 *100 + 0.5 * 200 + 0.6 *( unit – 300) ;
cout << “n The charges is Rs. “ << charge;
getch();
}
Simple C++ Programs for Learner's Guide
This site contains few sample c++ programs for beginners
"The best way to cheer yourself up is to try to cheer somebody else up." Mark Twain
Saturday, June 5, 2010
Tuesday, April 27, 2010
WAP to input acceleration (cm/sec*sec) and time . calculate the final velocity of an object , that is initially static.
#include <iostream.h>
#include <conio.h>
void main()
{
int ac, t, v;
cout<< "Enter acceleration in cm per second square ";
cin >> ac;
cout<< " Enter time to travarse ";
cin >> t;
v = ac * t;
// formula of final vel = initial vel + acceleration * time (initial vel = 0)
cout << " Final velocity = " << v << " cm / sec*sec ";
getch();
}
#include
void main()
{
int ac, t, v;
cout<< "Enter acceleration in cm per second square ";
cin >> ac;
cout<< " Enter time to travarse ";
cin >> t;
v = ac * t;
// formula of final vel = initial vel + acceleration * time (initial vel = 0)
cout << " Final velocity = " << v << " cm / sec*sec ";
getch();
}
Subscribe to:
Posts (Atom)
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do it blows your whole leg off.
Full Web Building Tutorials
Execellent Free Tutorials for VB, HTML, PHP, FLASH, Computer Hardware
Now Playing: Ballade Pour Adeline
Free Music Downloads | Free ringtones at EZ-Tracks.com
About Me
- Rinka
- I m an IT lecturer of a college. I love social-work. I want to do something beneficial for society before dying , that can promote our society, to some extent.