ProblemSheet - Decision Making - Biotech

You might also like

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

PSG COLLEGE OF TECHNOLOGY

DEPARTMENT OF COMPUTER APPLICATIONS


COURSE CODE & TITLE : 23B104 - PROBLEM SOLVING AND C PROGRAMMING
SEMESTER :1

Problem Sheet - Decision Making Statements


1. Write a program to check whether a given number is Odd or Even.

2. Write a program to check whether the given integer is a multiple of both 5 and 7
3. Write a program to input sides of a triangle and check whether a triangle is equilateral, scalene
or isosceles triangle using if else.
Properties of triangle are as follows
• A triangle is said Equilateral Triangle, if all its sides are equal. If a, b, c are three sides of
triangle. Then, the triangle is equilateral only if a == b == c.

• A triangle is said Scalene Triangle, if none of its sides are equal.

• A triangle is said Isosceles Triangle, if its two sides are equal. If a, b, c are three sides of
triangle. Then, the triangle is isosceles if either a == b or a == c or b == c.

4. Write a program that reports the contents of a compressed gas cylinder based on the first letter
of the cylinder's color. The program obtains a input character that represents the color of the
cylinder as ‘Y’ or ‘y’ for yellow, ‘O’ or ‘o’ for orange, and so on. Cylinder color’s and
associated contents are as follows:

Cylinder Color Cylinder Content


Orange Ammonia
Brown Carbon Monoxide
Yellow Hydrogen
Green Oxygen

Your program should respond to input character other than the first letter of the above colors
with the message: "Contents unknown"

5. Write a program to implement the flowchart given below based on the pH value given by the
user.
6. A company has the following discount policy for the goods purchased. If the product purchased
is under Rs.2000, no discount is given. On purchases for Rs. 2000 and above but less than
Rs.5000, a discount of 5% is given. On purchase of goods for Rs.5000 and above, a discount of
8% is given. Write a program to accept the purchase amount and print the final bill amount.

7. Write a program that prompts the user to input total number of phone calls made and calculate
the monthly telephone bill as per the following conditions:

Minimum Rs.200.00 for up to 100 calls


Plus Rs.2.00 per call, for the next 50 calls
Plus Rs.3.50 per call, for the next 50 calls
Plus Rs.4.50 per call, for calls beyond 200 calls
8. Admission to professional courses is subject to the following conditions:

a. Marks in Mathematics >=60


b. Marks in Physics >=50
c. Marks in Chemistry >=45
d. Total in all three subjects >=200 (or) Total in Mathematics and Physics >=150

Write a program to check whether a particular student’s mark is eligible for admission or
not.

9. Write a program to calculate the income tax payable by the user based on the total income.
The tax is calculated as per the below table.

Total Income Tax Rate


Upto Rs. 9,525 Nil
Rs. 9,526 to Rs. 38,700 12%
Rs. 38,701 to Rs. 82,500 22%
>82,500 32% + Rs.1000

Hint: Tax_payable= Total_Income*(tax_rate/100)

10. Write a program to compute the area of geometrical shapes using switch case as follows.

Input Character To Compute Formula


C or c Area of Cube 6a2
P or p Area of Rectangular Prism 2(wl+hl+hw)
T or t Area of Trapezium (0.5)*(a+b)*h
O or o Area of Parallelogram b*h

If the user enters any other input characters print as INVALID input.

You might also like