My programs does its function when both numbers are positive but when one of them is negative it does not.
#include <iostream>
using namespace std;
int main(){
int a,b;
b > 0;
cin >> a >> b;
int d;
d = a/b;
int r;
r = a%b;
cout << d << " " << r << endl;
}
In my program:
- 32/6 = 5 2 (division and remainder)
- -32/6 = -5 -2 (division and remainder)
What program is supposed to do:
- 32/6 = 5 2 (division and remainder)
- -32/6 = -6 4 (division and remainder)