Clock - Problem Description
Clock - Problem Description
Problems for lab exercise for the course "Programming Basics" course @ SoftUni Global
Submit your solutions to the SoftUni Judge system: https://judge.softuni.org/Contests/4587
1. Clock
Write a function that prints the hours of the day from 0:0 to 23:59, each on a separate line. The hours must be
printed in the format "{hours}:{minutes}".
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
2. Find the product of the two multipliers and print the result:
3. Combinations
Write a function that calculates how many solutions in natural numbers (including zero) have the equation:
x1 + x2 + x3 = n
The number n is an integer and is entered from the console.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
3. Check the innermost nested loop for the values of x1, x2, and x3 in each iteration. For the equation to be
valid, its sum must be equal to n. Create a combinations_count variable to store the number of valid
combinations and add to it each time you generate one:
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
5. Traveling
Annie loves to travel and wants to visit several different destinations this year. When she chooses a destination, she
will decide how much money she will need to get there and start saving. When she has saved enough, she will be
able to travel.
Each time, the console will first read the destination and the minimum budget (a floating-point number) that will
be needed for the trip.
Then several sums (floating-point numbers) will be read that Annie saves by working and when she manages to
save enough for the trip, she will leave, and it should be printed on the console:
"Going to {destination}!"
When she has visited all the destinations she wants, instead of a destination she will enter "End" and the program
will end.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
6. Building
Write a function that outputs on the console the room numbers in a building (in descending order) when the
following conditions are met:
On each even floor, there are only offices
On each odd floor, there are only apartments
Each apartment is marked as follows: A{floor number}{apartment number}, apartment numbers start from
0
Each office is marked as follows: O{floor number}{office number}, office numbers also start from 0
There are always apartments on the top floor, and they are bigger than the others, that is why they have 'L'
instead of 'A' in front of their number. If there is only one floor, there are only big apartments!
Two integers are read from the console – the number of floors and the number of rooms per floor.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.
© SoftUni – https://softuni.org. Copyrighted document. Unauthorized copy, reproduction or use is not permitted.