A1-Programming Fundamentals
A1-Programming Fundamentals
Skills to be Tested:
● Writing C++ program that converts user input into the required output after doing some processing on
it. (CLO1)
In a prestigious mathematics competition called the "Polygon Geometry Contest," brilliant young
mathematicians from all over the world gather to showcase their skills in geometry. The contest features a
variety of problems related to polygons, and participants need to write code to solve these problems.
The Challenge:
"Given an n-sided regular polygon, calculate and print the total sum of internal angles (in degrees). Use the
formula (n - 2) x 180, which gives the sum of all the measures of the angles of an n-sided polygon."
Skill: Compiling and Executing programs while taking input from the user
Programming Fundamentals
Week 03 – Programming Problems-Assignment
The doctor at the clinic has provided the following weight loss recommendations:
The doctor informs clients that by strictly adhering to these suggestions, they can expect to lose 1 kilogram of
weight after 15 days. The clinic wants the software to allow users to input their name and calculate the number
of days required to lose a specified amount of weight based on these recommendations.
Skill: Compiling and Executing programs while taking input from the user
Programming Fundamentals
Week 03 – Programming Problems-Assignment
Task 06(CP): (Movie Theater)
A movie in a local theater is in great demand. To help a local charity, the theater owner has decided to donate
to the charity a portion of the total amount generated from the movie. Write a c++ program that prompts the
user to input the
1. Movie name
i. Adult ticket price
2. Child ticket price
3. The number of adult tickets sold.
4. The number of child tickets sold.
5. Percentage of the amount to be donated to the charity.
First of all, you have to Calculate the total amount generated by the total sold tickets. Then after donating to
the charity from the total amount, show the remaining amount achieved from the movie on the Screen.
The output should be the earnings of all fruits and vegetables in Rps on the console.
Skill: Compiling and Executing programs while taking input from the user
Programming Fundamentals
Week 03 – Programming Problems-Assignment
● When you take the modulus of 4 with 3, it returns 1 because 4 divided by 3 leaves a remainder of 1.
● If you try 7 % 4, it returns 3 because 7 divided by 4 leaves a remainder of 3.
● If you try 7 % 10, it returns 7 because 7 divided by 10 leaves a remainder of 7.
With this knowledge in mind, create a C++ program to calculate the sum of the individual digits of a 4-digit
number. This program will allow you to input any 4-digit number, and it will use the modulus operator to
extract each digit and find their sum.
Skill: Compiling and Executing programs while taking input from the user
Programming Fundamentals
Week 03 – Programming Problems-Assignment
Task 09(CP): (Complex Calculation)
Imagine a program that takes 15 numbers as input, with a specific plan in mind for mathematical operations.
The program's goal is to perform various calculations on these numbers in a structured manner.
You are tasked with developing a program to analyze a person's residence history and calculate the average
duration they've spent living in a single house. This calculation is based on two critical factors: the person's
current age and the number of times they've moved from one house to another.
Input Data:
Skill: Compiling and Executing programs while taking input from the user
Programming Fundamentals
Week 03 – Programming Problems-Assignment
1. The person's age (age) represented as an integer.
2. The number of times they've moved house (moves) also represented as an integer.
The goal is to develop a program that can efficiently calculate the average number of years the person has
lived in a single house based on this input.
I have a bucket containing an amount of navy-blue paint and I'd like to paint as many walls as possible.
Create a program that prints the number of complete walls that I can paint, before I need to head to the shops
to buy more.
Notes
● Don't count a wall if I don't manage to finish painting all of it before I run out of paint.
● All walls will have the same dimensions.
● All numbers will be positive integers.
Skill: Compiling and Executing programs while taking input from the user
Programming Fundamentals
Week 03 – Programming Problems-Assignment
Skill: Compiling and Executing programs while taking input from the user