diff --git a/src/hw_2-2_incompleteQuotient/hw_2-2_incompleteQuotient.c b/src/hw_2-2_incompleteQuotient/hw_2-2_incompleteQuotient.c new file mode 100644 index 0000000..ec9690d --- /dev/null +++ b/src/hw_2-2_incompleteQuotient/hw_2-2_incompleteQuotient.c @@ -0,0 +1,25 @@ +#include +#include + +int main(void) +{ + int a; + int b; + int quotient = 0; + scanf("%d", &a); + scanf("%d", &b); + + if (b == 0) { + printf("Ошибка: деление на 0\n"); + return -1; + } + + while ((quotient + 1) * abs(b) <= abs(a)) + quotient++; + + if (a * b < 0) + quotient = -quotient; + + printf("Неполное частное = %d", quotient); + return 0; +}