Class Test 9
Class Test 9
1. Write a C++ program to input principal amount and time. If time is more than 10 years, calculate
the simple interest with rate 8%. Otherwise calculate it with rate 12% per annum. Repeat this
work till user’s choice is ‘yes’. 3
2. An electricity board charges according to following rates: 3
For the first 100 units-4 rs per unit
For the next 200 units-5 rs per unit
Beyond 300 units-6 rs per unit
All users are charged meter charge also which is Rs. 50/- Write a program to read the names
of users and number of units consumed, and print out the charges with names.
3. Find out syntax error: 2
#include<iostream.h>
void main[ ]
{ int X, Y;
cin<<X;
for(Y=0,y<10,Y++)
if( X=Y)
cout>>Y+X;
else
cout>>Y; }
4. Write a program to display reverse of a number entered by the user. 3
5. Write code to make the following pattern with n rows: 3
*
* *
* * *
* * * *