Quotient

After the quotient obtained by dividing two integers.
note:

If the denominator is zero, the output Error: the divisor can not be 0.
Otherwise, output Quotient is xxx

Test Example:
Test Input: 30
Expected Output: Error: the divisor can not be 0.
test input: 124
Expected Output: Quotient is 3

#include <iostream>
using namespace std;
int main()
{
 int a,b=0;
 cin>>a>>b;
 if(b==0)
 {
  cout<<"Error:the divisor cannot be 0."<<endl;
 }
 else
 {
  cout<<"Quotient is "<<a/b<<endl;
 }
}
Published 102 original articles · won praise 93 · views 4989

Guess you like

Origin blog.csdn.net/huangziguang/article/details/104557693
Recommended