(Multiples) Write a function multiple that determines for a pair of integers whether the sec- ond is a multiple of the first. The function should take two integer arguments and return true if the second is a multiple of the first, false otherwise. Use this function in a program that inputs a series of pairs of integers.

What will be an ideal response?


```
// Determines whether, for a pair of integers,
// the second is a multiple of the first.
#include
using namespace std;

bool multiple( int, int ); // function prototype

int main()
{
int x; // first integer
int y; // second integer

// loop 3 times
for ( int i = 1; i <= 3; i++ )
{
cout << "Enter two integers: ";
cin >> x >> y;
// determine if second is multiple of first
if ( multiple( x, y ) )
cout << y << " is a multiple of " << x << "\n\n";
else
cout << y << " is not a multiple of " << x << "\n\n";
} // end for

cout << endl;
} // end main

// multiple determines if b is multiple of a
bool multiple( int a, int b )
{
return !( b % a );
} // end function multiple
```

Computer Science & Information Technology

You might also like to view...

RealMedia is the standard format for videos distributed on commercial DVDs.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Discuss two purposes of adding comments to VBA procedures

What will be an ideal response?

Computer Science & Information Technology

Case-Based Critical Thinking QuestionsCase 6-2Leon recently started to use CSS positioning properties to position his Web page elements and has been very frustrated. He asked his cousin James to give him some examples and general information that will help him better understand what to do.Which of the following does James tell Leon that he can use with absolute positioning to position an image 50 pixels from the top?

A. top: -50px B. top: 50em C. bottom: -50px D. top: 50px

Computer Science & Information Technology

The tag-transform property allows you to specify that text be displayed in uppercase, lowercase, or capitalized.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology