Try the fastest way to create flashcards
Question

The date June 10, 1960, is special because when it is written in the following format, the month times the day equals the year:

6/10/606/10/60

Design a program that asks the user to enter a month (in numeric form), a day, and a twodigit year. The program should then determine whether the month times the day equals the year. If so, it should display a message saying the date is magic. Otherwise, it should display a message saying the date is not magic.

Solution

Verified
Step 1
1 of 3

This program should be able to take two different paths depending on whether the date is `magic' or not. So we will use an if - else\texttt{if - else} structure. To compare the result of multiplying the day and month to the year, we will use the ==\texttt{==} operator (be careful not to confuse this equality operator with the assignment operator =\texttt{=}).

Create a free account to view solutions

Create a free account to view solutions

Recommended textbook solutions

Starting Out with Python 3rd Edition by Tony Gaddis

Starting Out with Python

3rd EditionISBN: 9780133582734Tony Gaddis
618 solutions
Fundamentals of Database Systems 7th Edition by Ramez Elmasri, Shamkant B. Navathe

Fundamentals of Database Systems

7th EditionISBN: 9780133970777Ramez Elmasri, Shamkant B. Navathe
948 solutions
Introduction to Algorithms 3rd Edition by Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen

Introduction to Algorithms

3rd EditionISBN: 9780262033848Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
872 solutions
Introduction to Algorithms 4th Edition by Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen

Introduction to Algorithms

4th EditionISBN: 9780262046305Charles E. Leiserson, Clifford Stein, Ronald L. Rivest, Thomas H. Cormen
945 solutions

More related questions

1/4

1/7