1

Division program in C

view story
linux-howto

http://stackoverflow.com – I'm doing a program that shows how to make division in binary code. #include <stdio.h> #include <stdlib.h> unsigned int division(unsigned int a, unsigned int b) // fonction division { int i; b = (b << 16); for(i = 0; i <= 15; i++) { a = (a << 1); if(a >= b) { a = a - b; a = a + 1; } } return a; } int main() { unsigned int i, a, b, d, N; unsigned short c; FILE* rep; rep = fopen("reponse.txt", "w"); /* ouverture du fichier */ printf("Entrer le nombre de division (HowTos)