Solved

# data entry error..!!

Posted on 1998-09-04

Can somebody please tell me what to put in my code for positive integer division if someone enters a negative number...?? This is my code:

/*integer division using 2 positive integers

*/

#include <stdio.h>

#include <stdlib.h>

#include <math.h>

{

main ()

int dividend = N;

int didvisor = D;

int quotient = Q;

int remainder = R;

printf("Enter a positive whole number to be used as the dividend");

scanf("%d", &N);

printf("Enter a positive whole number to be used as the divisor");

scanf("%d", &D);

//perform the integer division

Q = N/D;

printf("\n The quotient is %d", Q);

//perform the modulus

R = N%D;

printf(("\n The remainder is %d", R);

return 0;

}