Programming - cpueblo.com

뺄셈으로 나누기 구현하기


글쓴이 : 유광희 날짜 : 2002-05-13 (월) 16:49 조회 : 16108

unsigned int Div(unsigned int a, unsigned int b)
{
	unsigned int ret = 0;
	while(a>=b)
	{
		a-=b;
		ret++;
	}

	return ret;
}

void main()
{
	printf("4321/1234 = %d(%d)\\n",4321/1234, Div(4321,1234));
}