Zahoor Ahmad

 

Home

C/C++

TQM

Data Analysis

Statistics

Computer

Contact

 

Computer Programming (C & C++)-1564

Programming Problems for Selection Statements :-

1

 

Write a program to accept an integer and print whether the given integer is Odd or Even.

 

 

 

 

 

 

2

  Write a program that reads three nonzero integers and determines and prints if they could be sides of a right triangle.

 

   

 

   

3

  Write a program which checks whether the roots of the quadratic equation
 ax2 + bx + c = 0, are equal, real or imaginary. (Roots are real, equal or imaginary if disc >0, =0, or <0. where disc = b2  - 4 ac.)

 

   

4

  Radars are mounted on the Lahore-Islamabad Motorway (M2) to check over speeding. It is decided to base the fine for speeding on the following rates:
Rs.300 if speed is between 100 and 120 Km/h, Rs.500 if the speed is between 121 and 150 Km/h and Rs. 1000 if the speed is above 150 Km/h.
Write a program to automate the assessment of fines.

 

   

 

 

5

  Write a C++ program which when two integers x and y are input will output the absolute difference of the two integers. That is whichever one of (x-y) or (y-x) is positive.

 

     

6

  Write a program using a nested if-else statement that will assign a character grade to a percentage mark as follows - 70 or over A, 60-69 B, 50-59 C, 40-49 D, 30-39 E, less than 30 F. Also print out the student's average mark (to the nearest integer) and also include a grade A to F alongside the average mark as defined above.
     

7

  Write a program to calculate the electricity bill on the following rates.
Cost is Rs. 6.613 per unit for first 100 units, Rs. 8.523 per unit for next 200 units and Rs. 11.875 for remaining units. General Sales Tax is added to the bill at the rate of 15% of the total cost of electricity.

 

   

8

 

Write a program that calculates the mobile phone bill of a customer of the mobile company MoreCall. Your program should prompt user to enter the number of total minutes of outgoing calls and number of SMSs sent.. Billing rate is 1.74 rupees per minute if total minutes does not exceed 150, it is 1.05 rupees per minute if total minutes exceed 150 but does not exceed 500 and it is 0.55 rupees per minute if total minutes exceed 500. First 100 SMSs are free of cost. If SMSs exceed 100 then charged at a rate of 0.25/SMS.

 

   

9

  Write a program to compare the consistency of two distributions. Mean and variances to be provided by the user.

 

   

10

  Write a program that, given the number of hours an employee worked and his hourly wage, computes his weekly pay. Count any hours over 40 as overtime at time-and-a-half (i.e. at one and half times the hourly wage).
     

 

 

The End

 



 

If you find any advertisement showing some indecent material please report its web address (URL) on contact page. It will help us to block such websites to show their ads in future. Sorry for inconvenience.