Answer to Question #125068 in C++ for Zeeshan Ali

Question #125068
Write a program that prompts the user to enter an integer. If the number is a multiple of 5, print
HiFive. If the number is divisible by 2, print HiEven.
1
Expert's answer
2020-07-03T09:42:44-0400
#include <iostream>
using namespace std;


int main()
{
	// user prompt
	cout << "Please, print an integer" << endl;


	// reading an integer
	int x;
	cin >> x;


	// if the number is a multiple of 5
	if (x % 5 == 0) {
		cout << "HiFive" << endl;
	}


	// if the number is divisible by 2
	if (x % 2 == 0) {
		cout << "HiEven" << endl;
	}


	/*
	Examples:


	Please, print an integer
	75
	HiFive


	Please, print an integer
	42
	HiEven


	Please, print an integer
	100
	HiFive
	HiEven
	*/
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS