Answer:
<em>The program written in Python is as follows;</em>
time_now = int(input("Time: "))
wait_time = int(input("Alarm: "))
time_now = time_now + wait_time%24
if time_now < 12:
print(str(time_now)+"am")
else:
time_now = time_now - 12
print(str(time_now)+"pm")
Explanation:
This line prompts user for current time
time_now = int(input("Time: "))
This line prompts user for the alarm hours
wait_time = int(input("Alarm: "))
This line calculates the time of the alarm
time_now = time_now + wait_time%24
The following if statement determines if the time will be am or pm
If the time is less than 12, then the time will be in am
<em>if time_now < 12:
</em>
<em> print(str(time_now)+"am")
</em>
If otherwise, then the time will be in pm
<em>else:
</em>
<em> time_now = time_now - 12
</em>
<em> print(str(time_now)+"pm")</em>
<em></em>