[go: up one dir, main page]

0% found this document useful (0 votes)
2 views22 pages

Practical File

The document is a practical file for a programming lab course submitted by Kamaldeep Singh. It contains a series of programming exercises aimed at solving various problems, such as calculating salaries, determining leap years, and implementing games. Each exercise requires writing a specific program based on user input and predefined conditions.

Uploaded by

deepdecoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views22 pages

Practical File

The document is a practical file for a programming lab course submitted by Kamaldeep Singh. It contains a series of programming exercises aimed at solving various problems, such as calculating salaries, determining leap years, and implementing games. Each exercise requires writing a specific program based on user input and predefined conditions.

Uploaded by

deepdecoor
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Practical File

Programming for Problem Solving (lab)

Name - Kamaldeep singh


Roll no – 2328030
Class – B.Tech (CSE)
Semester - 2nd
Subject code – BTPS102-18
Submitted to – Dr. Monika
Sachdeva Mam
1. Ramesh’s basic salary is input through the keyboard. His dearness allowance
is 40% of basic salary, and house rent allowance is 20% of basic salary. Write
a program to calculate his gross salary.
2. If a five-digit number is input through the keyboard, write a program to
calculate the sum of its digits
3. If a four-digit number is input through the keyboard, write a program to
obtain the sum of the first and last digit of this number.
4. Any year is input through the keyboard. Write a program to determine
whether the year is a leap year or not.
5. A five-digit number is entered through the keyboard. Write a program to
obtain the reversed number and to determine whether the original and
reversed numbers are equal or not.
6. If the ages of Ram, Shyam and Ajay are input through the keyboard, write a
program to determine the youngest of the three.
7. Given the length and breadth of a rectangle, write a program to find
whether the area of the rectangle is greater than its perimeter. For example,
the area of the rectangle with length = 5 and breadth = 4 is greater than its
perimeter.
8. Given a point (x, y), write a program to find out if it lies on the x-axis, y-axis
or at the origin, viz. (0, 0)
9. Write a program which to find the grace marks for a student using switch.
The user should enter the class obtained by the student and the number of
subjects he has failed in. – If the student gets first class and the number of
subjects he failed in is greater than 3, then he does not get any grace. If the
number of subjects he failed in is less than or equal to 3 then the grace is of
5 marks per subject. − If the student gets second class and the number of
subjects he failed in is greater than 2, then he does not get any grace. If the
number of subjects he failed in is less than or equal to 2 then the grace is of
4 marks per subject. − If the student gets third class and the number of
subjects he failed in is greater than 1, then he does not get any grace. If the
number of subjects he failed in is equal to 1 then the grace is of 5 marks per
subject
10. Write a program to calculate overtime pay of 10 employees. Overtime is
paid at the rate of Rs. 12.00 per hour for every hour worked above 40 hours.
Assume that employees do not work for fractional part of an hour.
11.Write a program to find the factorial value of any number entered through
the keyboard.
12. Two numbers are entered through the keyboard. Write a program to find
the value of one number raised to the power of another.
13.Write a program to print all the ASCII values and their equivalent characters
using a while loop. The ASCII values vary from 0 to 255
14. Write a program for a matchstick game being played between the
computer and a user. Your program should ensure that the computer always
wins. Rules for the game are as follows: − There are 21 matchsticks. − The
computer asks the player to pick 1, 2, 3, or 4 matchsticks. − After the person
picks, the computer does its picking. − Whoever is forced to pick up the last
matchstick loses the game.
15. Write a program to enter the numbers till the user wants and at the end it
should display the count of positive, negative and zeros entered.

You might also like