Inactive Tutor answered 03/08/22
#include <iostream>
using namespace std;
int main(int argc, char **argv) {
int num;
cin >> num;
if ((num % 3) == 0) {
cout << "Go";
}
if ((num % 5) == 0) {
cout << "Lakers";
}
cout << endl;
return 0;
}
Brock T.
asked 03/08/22Concepts tested: integer operations, selection statements
Write a program that:
1) Reads in an integer from the console (do NOT print out any instructions/prompts for the user)
2) Prints "Go" if the number is divisible by 3
3) Prints "Lakers" if the number is divisible by 5
4) Prints "GoLakers" if the number is divisible by 3 and 5
Inactive Tutor answered 03/08/22
#include <iostream>
using namespace std;
int main(int argc, char **argv) {
int num;
cin >> num;
if ((num % 3) == 0) {
cout << "Go";
}
if ((num % 5) == 0) {
cout << "Lakers";
}
cout << endl;
return 0;
}
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.