Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Assignment 1 PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Pimpri Chinchwad Education Trust’s

Pimpri Chinchwad College of Engineering, Pune

Department: Department of Applied Sciences & Humanities Academic Year: 2022-23 Sem: I

Subject: Computer Programming and Problem Solving - I Laboratory (BAS1321)

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

Pimpri Chinchwad College of Engineering, Pune

Department: Department of Applied Sciences & Humanities Academic Year: 2022-23 Sem: I

Subject: Computer Programming and Problem Solving - I Laboratory (BAS1321)

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

Pimpri Chinchwad College of Engineering, Pune

Department: Department of Applied Sciences & Humanities Academic Year: 2022-23 Sem: I

Subject: Computer Programming and Problem Solving - I Laboratory (BAS1321)

Output : Gross Salary is


Step 8: tax = 2/100 * gross_sal
Output : Professional Tax is
Step 9 : payble_sal = gross_sal - tax
Output : Payable Salary of an employee is
Step 10 : stop

Flowchart:
Pimpri Chinchwad Education Trust’s

Pimpri Chinchwad College of Engineering, Pune

Department: Department of Applied Sciences & Humanities Academic Year: 2022-23 Sem: I

Subject: Computer Programming and Problem Solving - I Laboratory (BAS1321)

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

Conclusion: The program is calculating the net salary of an employee correctly.

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

2. List and explain arithmetic operators in C.

You might also like