Share
C Programming PRACTICAL QUESTIONS
1.

Write a salary calculator program in c that ask a user to enter the hours worked in the month, the hourly rate and the tax rate. Your program should then calculate the gross salary, the tax and the net salary.

Program Design:

Enter the hours worked in the month > 45
Enter the hourly rate > 8.5
Enter the tax rate > 21
Gross Salary: Ghc 382.5
Tax: Ghc 80.325
Net Salary: Ghc 302.175

Formula:

Gross Salary = Hours Worked x Hourly Rate
Tax = Tax Rate x Gross Salary / 100
Net Salary = Gross Salary - Tax

Show Solution
2.

The following is the grading system of a university college. Write a program which asks a student to enter his score. Your program should display the grade for the entered score. Your program should give the user the possibility to enter another score for grading by entering a particular character to exit or continue the program.

Grading System

80 - 100 A
75 - 79 B+
70 - 74 B
65 - 69 C+
60 - 64 C
55 - 59 D+
50 - 54 D
Below 50 E

Program Design

************************************
GRADE CALCULATOR
************************************

Enter the examination score > 89
Grade A
Enter e to exit or c to continue > c
Enter the examination score > 67
Grade C+
Enter e to exit or c to continue > e

Show Solution
3.

You have been contacted by a science teacher to design a program to calculate either the kinetic energy or potential energy of a body to be used by his students to verify their calculated results.

The program should ask the user to enter 1 to calculate potential energy or 2 to calculate the kinetic energy. Base on the option entered, your program should ask the user to enter the necessary inputs and display the result.

Your program should ask the user to enter a character to calculate another or to exit the program.

Program Design

************************************
ENERGY CALCULATOR
************************************

Enter 1 for potential energy or 2 for kinetic energy calculation > 1
Enter the mass of the body > 15
Enter the height of the body > 2
Enter the acceleration due to gravity > 9.8
Potential energy = 294.00J
Enter e to exit or c to continue > c
Enter 1 for potential energy or 2 for kinetic energy calculation > 2
Enter the mass of the body > 20
Enter the velocity of the body > 5
Kinetic energy = 250.00J
Enter e to exit or c to continue > e

Formula:

Potential Energy = Mass x Height x Acceleration Due To Gravity
Kinetic Energy = Mass x Velocity2 / 2

Show Solution

SponsoredAdvertise

Kuulchat Premium