Hello World Lab 2
NOTE: Some exercises below may be collected from an interview with big tech companies, like FAANG (Facebook, Amazon, Apple, Netflix, Google) and others like Microsoft, etc. Be sure to have a try!
Questions
1. Print last two digits
Given an integer greater than 9, print its last two digits.
Example:
>>> 1234 # input
34 # output2. Print tens
Given an integer, print its tens digit.
Example:
>>> 1234 # input
3 # output3. Sum of three digits
Given a three-digit number. Find the sum of its digits.
Example:
>>> 123 # input
6 # output4. Print tenth
Given a positive float number, print its first digit to the right of the decimal point (the tenth digit).
Example:
>>> 1.79 # input
7 # output5. Find century of year
Given a year (as a positive integer), find out which century is the year in. For example, if we receive 2000, the program should print out 20 since the year 2000 is in the 20th century.
Example:
>>> 2000 # input
20 # output6. Time past midnight
Given the integer N - the number of seconds that have passed since midnight. How many full hours and full minutes have passed since midnight?
The program should print two numbers: the number of hours (between 0 and 23) and the number of minutes (between 0 and 1439). Both outputs should be in one line.
Example: If N = 3900, then 3900 seconds have passed since midnight - i.e. now it's 1:05am. So the program should print 1 65 - 1 full hour is passed since midnight while 65 full minutes have passed since midnight.
>>> 3900 # input N
1 65 # output hours passed and minutes passed