Answer:
#include <iostream>
using namespace std;
int main()
{
int mt, day, yr, magic;
cout << "Enter a month(numeric form)"<< endl;
cin >> mt;
cout << "please enter a day"<<endl;
cin >> day;
cout << "please enter a year"<< endl;
cin >> yr;
// Input Validation
if (mt<1 || mt>12){
cout<<"Invalid Month";
}
else if (day<1||day>31){
cout<<"Invalid Day";
}
else if (yr>99||yr<0){
cout<<"Invalid Year";
}
else{
// Calculates magic
magic = (mt * day);
if (magic == yr)
{
cout << "it is a magic year"<<endl;;
}
else
cout << "It is not a magic year" << endl;
}
return 0;
}
Explanation:
Using C++ we request the user to enter values for Month, day and year (two digits). We carry out input validation to ensure the user enters a valid month, day and year. Using if/elseif/if statements we ensure the conditions given in the question.
Hello i am kust gere to answer the qustions nothing else
Answer:
I had a similar problem. I would suggest consulting someone professionally because thats what I had to do. I really dont know why it does that
Answer:
In Python:
def count_over_100(mylist):
kount = 0
for i in range(len(mylist)):
if mylist[i] > 100:
kount+=1
return kount
Explanation:
This defines the function
def count_over_100(mylist):
(1) This initializes kount to 0
kount = 0
(2) This iterates through the loop
for i in range(len(mylist)):
If current list element is greater tha 100, kount is incremented by 1
<em> if mylist[i] > 100:</em>
<em> kount+=1</em>
This returns kount
return kount