### need help

Can help me how shld i write the programe

The user enters two numbers and uses the conditional expression operator to determine whether the first integer is a multiple of the other. An integer, m is a multiple of an integer n if the remainder from the integer division of m by n is 0.

#include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
if((x%y)==0){
cout<<"X is the multiple of the Y"<<endl;
}
else{
cout<<"X is not the multiple of the Y"<<endl;
}
system("pause");
return 0;
}
Be specific about what part you're stuck at. Somebody just writing the whole thing is not going to help you much.
hi mattchin92, thanks alot. This is what I want. Can check with you, continue from what you have written, how do i solve this from what you have written

part (b) If the first integer is a multiple of the other, use a loop to produce a multiplication time table based on this number. Inspect the sample output where the two entered numbers is 30 and 5 and use it as a guide for your coding

part (c) There is a requirement that the two numbers entered in Part (a) (from your code) has to be in the range of 1 to 50. Expand your code to include in this data validation.
Last edited on
hi, you means the multiplications table is based on the first integer or the multiple number?
#include<iostream>
using namespace std;
int main(){
int x,y;
cin>>x>>y;
if (x<=50&&x>=1){
if(y<=50&&y>=1){
if((x%y)==0){
for(int a=1;x<50;a++){
x=x*y;
if(x<50){
cout<<x<<endl;}
}
}
else{
cout<<"X is not the multiple of the Y"<<endl;
}
}}
system("pause");
return 0;
}
i duno izit u want this...i not so understand the part b
Last edited on
Hi mattchin92, I have sent you a private msg. Thanks alot
How join part (a) (b) (c) together?
Dude, you have to do SOME of it yourself. When someone does your homework for you, you can't just turn off your brain and make them to everything. You're going to fail your class if you keep this up.
Hi Stewbond, understand. Sorry. Cos i'm quite poor in programming
Topic archived. No new replies allowed.