Ips1 (Cse)
Ips1 (Cse)
No:-21BLC1206
n1+n2
n1*n2
n1/n2
n1%n2
n1**n2
n1//n2
Algorithm:
Step1. Start
Step2. Input value of n1 and n2
Step3. Sum= n1+n2
Division=n1*n2
Remainder=n1%n2
Power=n1**n2
Floor Division=n1//n2
Step4. Display sum, multiplication, division, remainder, power, floor division.
Step5. Stop
Python Code:
Output:
Question 2: Raman, a finance consultant decides to create a software application
for the public to make decision on the type of investment that they can make. The
input for the software application is the money in hand and the expected matured
amount after ‘n’ years. Write an algorithm and write the Python code to
determine the minimum rate of interest of policy that people may invest to get
the expected maturity amount. Formula to be used is:
* Rate of interest = ((expected matured amount-initial amount)/ (initial amount *
no of years))*100
* Print only two decimal places for rate of interest.
PAC Chart:
Given Data Required Result
1)Initial Amount
2)No. of years Rate Interest
3)Expected Matured amount
Algorithm:
Step1. Start
Step2. Input values a, b, c
Step3. Initialize new variable d
Step4. d=((c-a)/(a*b))*100
Step5. Display d
Step6. Stop
Python Code:
Output:
Question 3: Bob went to a supermarket to buy some items. The items he bought,
its quantity and the price is listed in the following table.
Item Quantity Price per
item
Bread 2 30
Butter 3 25
Jam 3 50
Write PAC, algorithm and python Code to calculate total amount Bob has to pay
to super market.
PAC Chart:
Given Data Required result
Algorithm:
Step1. Start
Step5. Stop
Python Code:
Output:
Question4:
A university is setting up a new lab at their premises. Design an algorithm and
write Python code to determine the approximate cost to be spent for setting up
the lab. Cost for setting the lab is sum of cost of computers, cost of furniture's and
labor cost. Use the following formulae for solving the problem:
Cost of computer = cost of one computer * number of computers, Cost of
furniture = Number of tables * cost of one table + number of chairs * cost of one
chair, Labor cost = number of hours worked * wages per hour
PAC Chart:
Given Data Required results
Algorithm:
Step1. Start
Step2. Input values of n1, n2, n3, n4, p1, p2, p3, p4
Step3. Total price= (n1*p1) + (n2*p2) + (n3*p3) + (n4*p4)
Step4. Print total price
Step5. Stop
Python Code:
Output:
Python Code:
Output:
Output:
Code:
Output:
Example 2:
Output:
Code:
Output:
Output:
Output:
Inference: The above questions and examples helped us understand the use
of Arithmatic, Relational, Logical and Ternary operators.