Assignment 1 PDF
Assignment 1 PDF
Assignment 1 PDF
Department: Department of Applied Sciences & Humanities Academic Year: 2022-23 Sem: I
DIVISION
ROLL NO OF STUDENT
NAME OF STUDENT
ASSIGNMENT NO 01
Write a program to calculate salary of an employee given his
basic pay (take as input from user). Calculate gross salary of
TITLE OF ASSIGNMENT employee. Let HRA be 10% of basic pay and TA be 5% of
basic pay. Let employee pay professional tax as 2% of total
salary. Calculate net salary payable after deductions.
DATE OF COMPLETION
Pimpri Chinchwad Education Trust’s
Department: Department of Applied Sciences & Humanities Academic Year: 2022-23 Sem: I
Assignment No. 01
Aim: Write a program to calculate salary of an employee given his basic pay (take as input from
user). Calculate gross salary of employee. Let HRA be 10% of basic pay and TA be 5% of basic
pay. Let employee pay professional tax as 2% of total salary. Calculate net salary payable after
deductions.
Objective: To demonstrate operators in C programming and perform simple arithmetic
operations.
Outcomes: Students will be able to
● Understand how to use arithmetic operator to find solution of the problem
● Library functions, gcc compiler
Theory:
Pseudo code:
Step 1 : Start
Step 2 : Output : Enter basic salary of an employee
Step 3 : Input : basic_sal
Output : Basic Salary of an employee
Step 4 : if basic_sal <= 0
then output : Salary can not be 0 or negative
exit
Step 5: hra = 10/100 * basic_sal
output : HRA is
Step 6: ta = 5/100*basic_sal
output : TA is
Step 7: gross_sal = basic_sal + hra + ta
Pimpri Chinchwad Education Trust’s
Department: Department of Applied Sciences & Humanities Academic Year: 2022-23 Sem: I
Flowchart:
Pimpri Chinchwad Education Trust’s
Department: Department of Applied Sciences & Humanities Academic Year: 2022-23 Sem: I
Test Cases:
1. Basic_sal = 10000
hra = 1000, ta = 500
gross_sal= 11500
tax = 230
payble_sal = 11270
2. Basic_sal = 0
Salary can not be 0 or negative
3. Basic_sal = -10000
Salary can not be 0 or negative
Program:
Output:
Questions:
1. Determine the size, minimum and maximum value following data types. Please specify if
your machine is 32 bit or 64 bits in the answer.
• char • unsigned char
• short • int
• unsigned int • unsigned long
• float
Hint: Use sizeof() operator, limits.h and float.h header files