MODULE 1 :
Q1) Two trains stop at regular intervals:
Train 1 stops at every 3rd station.
Train 2 stops at every 5th station.
Find:
The first common station where both trains stop.
The last common station where both trains stop.
All common stations where both trains stop.
Note: Total Number of Stations are unknown.
station = 1
last_station = station
while station <= 15:
if station % 3 == 0 and station % 5 == 0:
print(station)
print('First common station: ', station)
break
station+=1
Top comments (0)