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;
}
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.
#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
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.