Explore Westonci.ca, the leading Q&A site where experts provide accurate and helpful answers to all your questions. Connect with a community of experts ready to provide precise solutions to your questions on our user-friendly Q&A platform. Get detailed and accurate answers to your questions from a dedicated community of experts on our Q&A platform.

Write a piece of codes that asks the user to enter a month (an integer), a day (another integer), and a two-digit year. The program should then determine whether the month times the day is equal to 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.
#include
using namespace std;
int main()
{
int day;
int month;
int year;
cout<<"enter year"< cin>>year;
cout<<"enter day"< cin>>day;
cout<<"enter month"< cin>>month;
//programology..
if(month*day==year)
{
cout<<"its magic programology year"< }
else
{
cout<<"its not magic year"< }
}

Sagot :

Answer:

Follows are the code to this question:

#include <iostream>//header file

using namespace std;

int main()//main method

{

int day,month,year;//defining integer variable

cout<<"please enter last two digit of the year: "; //print message

cin>>year;//input year value

cout<<"enter day: "; //print message

cin>>day;//input day value

cout<<"enter month: ";//print message

cin>>month;//print month message

if(month*day==year)//check magic date condition  

{

cout<<"its magic programology year";//print message

}

else

{

cout<<"its not magic year";//print message

}

return 0;

}

Output:

please enter last two digit of the year: 98

enter day: 14

enter month: 7

its magic programology year

Explanation:

In the given code, three integer variable "day, month, and year" is declared, that uses the input method "cin" to input the value from the user-end.

In the next step, an if block statement is used that check month and day value multiple is equal to year value, if the condition is true it will print "magic programology year" otherwise it will print "not the magic year".

Thanks for stopping by. We are committed to providing the best answers for all your questions. See you again soon. Thanks for stopping by. We strive to provide the best answers for all your questions. See you again soon. We're dedicated to helping you find the answers you need at Westonci.ca. Don't hesitate to return for more.