Question
Sam and Michelle are fond of the Delicious restaurant. Sam will have his dinner in that restaurant on every 'i'th day. Michelle will have her
Sam and Michelle are fond of the "Delicious" restaurant. Sam will have his dinner in that restaurant on every 'i'th day. Michelle will have her dinner on every 'j'th day. Find the day on which Sam andMichelle will have their dinner together in that restaurant. When a day is less than or equal to zero, then display "<'i'th> to <'j'th> is not a valid interval".
Hint: Find out the LCM for given inputs.
Sample Input 1:
Enter the day interval of Sam
4
Enter the day interval of Michelle
6
Sample Output 1:
Sam and Michelle will have their dinner on day 12
Sample Input 2:
Enter the day interval of Sam
6
Enter the day interval of Michelle
8
Sample Output 2:
Sam and Michelle will have their dinner on day 24
Sample Input 3:
Enter the day interval of Sam:
-4
Enter the day interval of Michelle:
6
Sample Output 3:
-4 to 6 is not a valid interval
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started