Okay so I am suppose to write a program that divides two numbers without using the operator "/"
So i try writing the program using repeated subtraction, but I dont know if I am doing this right at all.
Heres my code
Code:
#include <stdio.h>
int main()
{
int a, b, max, min, results, count;
max = 2000000000;
min = -2000000000;
results = 0;
count = 0;
printf("Enter integer numbers 'a' and 'b' for division a/b: ");
scanf("%d %d", &a, &b);
if (b == 0) {
printf("Division by zero is not allowed!");
printf("\n");
return 0;
}
while (1) {
results = a - b;
count++;
if (b < a)
break;
}
printf("Division result is %d\n", count);
return 0;