In: Computer Science
Using pseudocode or C++ code, write code to print “small” if the
magnitude M of an earthquake is in the range [0, 3), “medium” if M
is in the range [3, 6), “large” if M is in the range [6, 9) and
“epic” if M is greater than or equal to 9, where M is input by a
user via the keyboard.
(in c++)
#include<iostream> using namespace std; int main() { int magnitude; cout << "Enter magnitude of the earthquake: "; cin >> magnitude; if (magnitude >= 0 && magnitude < 3) cout << "Small" << endl; else if (magnitude >= 3 && magnitude < 6) cout << "Medium" << endl; else if (magnitude >= 6 && magnitude < 9) cout << "Large" << endl; else if (magnitude >= 9) cout << "Epic" << endl; system("pause"); return 0; }