Write a program that reads two integers and then uses the conditional expression operator to print either “multiple” or “not” according to whether one of the integers is a multiple of the other.
#include <iostream>
#include <string>
using namespace std;
int main(void){
int number1;
int number2;
cout<<"Enter a number 1: ";
cin>>number1;
cout<<"Enter a number 2: ";
cin>>number2;
if(number1%number2==0){
cout<<"Multiple\n\n";
}else{
cout<<"Not\n\n";
}
system("pause");
return 0;
}
Comments
Leave a comment