(Multiples) Write a program that reads in two integers and determines and prints if the first is a multiple of the second. [Hint: Use the modulus operator.]
What will be an ideal response?
```
#include
using namespace std;
int main()
{
int number1; // first integer read from user
int number2; // second integer read from user
cout << "Enter two integers: "; // prompt
cin >> number1 >> number2; // read two integers from user
// using modulus operator
if ( number1 % number2 == 0 )
cout << number1 << " is a multiple of " << number2 << endl;
if ( number1 % number2 != 0 )
cout << number1 << " is not a multiple of " << number2 << endl;
} // end main
```
You might also like to view...
The current versions of both Firefox and Safari have adopted the ____ standard.
A. CSS3 B. CSSX C. CSS2 D. CSS1
A(n) ________ is composed of metal or ceramic and is used to cool the processor
Fill in the blank(s) with correct word
What are the advantages of using the full-duplex mode of operation?
What will be an ideal response?
What component connects LANs into a WAN?
A. Hub B. Router C. Modem D. Repeater