Pps I Assignment I Jyothi
Pps I Assignment I Jyothi
Assignment-I
1. Mr. Benjamin was suffering from a high fever so he went to a hospital to consult a doctor.
The doctor measured his temperature in Fahrenheit. Now help Benjamin to know his
temperature in centigrade. Write a C Program to it.
HINT: 00 C= (F-32)*5/9 Input Output 1020F 38.88890 C
2. Kashyap is very strong in programming as a part of this his teacher has given him a task. Now
it’s your aim to help Kashyap complete his task Given a number N, the task is to find whether the
number is a prime number (or) not. Input N=7 Output Prime number Input N= 9 Output is Not a
prime
3. Prof Martin has taught students the concepts related to Iterative models, with respect to this he
asked his students to complete a task. Given a number N, the task is to find 1+2+3+…… ..+N
Input N= 5 Output 15 Input N =3 Output 6
4. Ritish a store manager at phoenix mall. He was asked to create a price tag for different
perfumes of different brands by seeing a unique Id value. Now write a program which satisfies
the price tags. Input Format: Read ‘N’, as an integer value Input: 5 Output: price tag=120
(1*2*3*4*5) Input: 4 Output: price tag= 24
5. A Calculator is a small electronic device used to perform various arithmetic operations like
addition, subtraction, multiplication, division, percentage, etc. It makes our calculations easier
and faster. It is a portable device that can use anywhere to perform simple mathematical
operations. Dear students write a program to create a Calculator program using switch statement
Read an input in character mode (+,-,*,/,%) If ‘+’ is chosen we need to read two input numbers
from the user and print their sum, likely if ‘*’ is chosen print their product and so on …………..
Expected Input and Output
7. Mr. Kane William’s basic salary is given as 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. (Hint: gross salary = basic salary + dearness
allowance + house rent allowance)
8. A library charges a fine for every book returned late. For first 5 days the fine is 1 rupee,
for 6-10 days fine is two rupees and above 10 days fine is 5 rupees. If you return the book
after 30 days your membership will be cancelled. Write a program to accept the number
of days the member is late to return the book and display the fine or the appropriate
message.
9. Using the Switch statement, write a program that displays the following menu for the
food items available to take orders from the customer:
• B= Burger
• F= French Fries
• P= Pizza
• S= Sandwiches
The program inputs the type of food and quantity. It finally displays the total charges for
the order according to the following criteria:
Consider the cost of a burger as Rs 200, the cost of French fries as Rs 50, the cost of a
pizza as Rs 500, and the cost of a sandwich as Rs 150.
Expected Input and Output
Test _case:1
b=Burger
f=French Fries
p=pizza
s=Sandwiches
Enter your order using the first letters as (b,f,s,p)
f
your order is french_fries
please enter your quantity 10
Output:
your total charges is: 500
Explanation: Total charge= quantity*actual price
The actual price of French fries is Rs 50 => 10*50 =500
Test _case:2
b=Burger
f=French Fries
p=pizza
s=Sandwiches
Enter your order using the first letters as (b,f,s,p)
Y
Output:
Please your request is not available, visit another restaurant
Explanation: y is not taken as a label name.