PPS Lab Exercise-1
1. Write a C program that prints out the following menu for a game (include the line of
asterisks (#) on top and $ bottom):
###########################################################
Welcome!
Please choose a number from the following options:
1. Play the game!
2. Demo the game!
3. Exit
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
2. Write C code to generate the results as shown below: Results:
=======Quizzes===============
Enter the score of the first quiz: 90
Enter the score of the second quiz: 75
Enter the score of the third quiz: 91
=======Mid-term==============
Enter the score of the mid-term: 80
=======Final=================
Enter the score of the final: 89
Quiz Total: 256
Mid-term: 80
Final: 89
……………………
Total: 425
3. Get input of your name( as string), Register number(as string), address (as string), age in
years (Int), weight in kg (as float), height in meters (double), twelfth cgpa/percentage
(float read two decimal points only and display with one decimal point) from keyboard
and display the information as below:
Enter Name of Student: Surya
Roll Number: 522
Enter CGPA/percentage: 59.40
Name of Student: Surya
Roll Number: 522
Percentage Score Secured: 59.4%
4. In program get the values of age in years, weight in grams and height in cm then convert
the age into months, weight into kg, height into meters and display the student
information as follows,
Enter Name of Student: Surya
Roll Number: 522
Age in years: 18.5
Weight in gram: 55000
Height in cm: 163
Enter CGPA/percentage: 59.40
Name of Student: Surya
Roll Number: 522
Age in months: 222 months
Weight in Kilogram: 55
Height in meters: 1.63
Percentage Score Secured: 59.4%
5. Write a C program that takes hours, minutes and seconds (declare as long int) as input,
and calculates the total number of seconds.
Expected Output:
Input
hours: 5
minutes: 37
seconds: 10
Total: 20230 seconds.
6. Given the following pseudo code, write a program that executes it.
a. read x
b. read y
c. compute p=x*y
d. compute s=x+y
e. total=s2+p*(s-x)*(p+y)
f. print total
7. Write a program that reads a temperature in degrees Celsius and prints out the
corresponding temperature in degrees Fahrenheit (F = (C * 9 / 5) + 32).
8. Write a program that reads a temperature in degrees Celsius and prints out the
corresponding temperature in degrees Fahrenheit. Declare constant variable cv=32 and
use it in the formula (F = (C * 9 / 5) + cv).
9. Write a C program that will calculate how much of a profit an investor will make. You
will need to get the following three inputs:
the number of shares the investor purchased
the price of the stock (per share) when the investor purchased it
the price of the stock (per share) now
The formula to use: Profit = (# of shares * Current Price) – (# of shares * Purchase Price)
Output this message to the screen:
You have made a profit of $_____ dollars since you bought _____ shares of this stock.
Also, you must display the dollar amount formatted to two decimal places. Place this statement
at the start of your program: