Use Repeated Subtraction To Divide
04-07-2009 #1
Registered User
Division using repeated subtraction
Okay and then I am suppose to write a program that divides two numbers without using the operator "/"
So i try writing the program using repeated subtraction, just I dont know if I am doing this right at all.Heres my code
Lawmaking:
#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("Sectionalization by zero is non allowed!"); printf("\n"); return 0; } while (i) { results = a - b; count++; if (b < a) pause; } printf("Partition outcome is %d\n", count); return 0;
04-07-2009 #2
ATH0
B is never going to be less than A unless it is to first with, considering you aren't actually changing B or A. You're doing:C = A - B
D++And then are checking to see if B is less than A, without ever really changing anything other than C and D.
Quzah.
Promise is the first step on the road to disappointment.
05-27-2009 #10
Banned
no yous did notOriginally Posted past tropche
ಠ_ಠat least have some respect for me as a new member....
╔╗╔══╦╗
║║║╔╗║║
║╚╣╚╝║╚╗
╚═╩══╩═╝
Use Repeated Subtraction To Divide,
Source: https://cboard.cprogramming.com/c-programming/114517-division-using-repeated-subtraction.html
Posted by: jamesfiect1953.blogspot.com
0 Response to "Use Repeated Subtraction To Divide"
Post a Comment