please help me --

Write a function multiple that determines for a pair of integers whether the second integer 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.
. Example: If input is 256 and 8, output will be 256 is a multiple of 8
If input is 13 and 111, output will be 111 is not, a multiple of 13.


I don't understand the question can you help me pleas??

thank you
I would use a bool function to assist you in this. Or you can just use an if else statement.
A mod (%) could also be of use. So if there is a remainder your value is not a multiple of valueA.
It appears to be a problem mainly about the math. I hope this helps get you started.
to check if the first number is a multiple of the second number, divide the first number to the second if there is a remainder. if there is a remainder, then it is not a multiple of the second number.

example:

first number = 256
second number = 8

256/8 == 32.0 ///see? no remainder

like wat murphyslaws said, use mod (%) since it gets the modulus.

so wen you type:

256%8

it doesnt get 32 but the remainder(i.e "0")
oh thank u so much but I don't understand how can I use the function with it ??
#include<iostream>
using namespace std;

int maltiple(int y , int x)
{

cout<<"Enter tow entger number please\n";
cin>>y;
cin>>x;

if(y%x==0)
cout<<y<<"is maltiple of"<<x;
else
cout<<y<<"is not maltible of"<<x;

return y,x;

}
int main()
{





system("pause");
return 0;
}



what I have to write after int main ??
please help me

thank you .
Use code tags. But you just have to do this;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <iostream>

bool multiple(int x , int y)
{

int remainder;

remainder = x % y;

if (remainder == 0)
return true;

else
return false;

}

int main(){

int x;
int y;

std::cout << "Enter the 1st value: ";
std:: cin >> x;

std::cout << "Enter the 2nd value: ";
std::cin >> y;

if (multiple(x,y) == true)
std::cout << y << " is multiple of " << x;

else
std::cout << y << " is not a multiple of" << x;

return 0;
}
If you are going to post answers, can you at least comment the code? Otherwise, this is of little benefit to the OP.
I'm sorry really I don't know I forget ,sorry again and thank u ^^
I'm sorry but I don't see what i can comment. The code is so simple. It is pretty much self explanatory.

Topic archived. No new replies allowed.