Dividing two numbers
You have to divide A by B without using division operator and modulus operator ?
PS: Repeated Subtraction is not allowed..
I have thought of a solution but i am not satisfied with that so asking for help of CEans
Member • Jan 9, 2011
Member • Jan 9, 2011
Member • Jan 9, 2011
Here, I think the printf statement should be outside the while loop!! 😀srinivas_jhi!! dude the following code serves your purpose!!
#include<stdio.h>
void main()
{
float a,b,r=0;
printf("\n\n\tEnter Values of a & b :");
scanf("%d%d",&a,&b);
while(b*r <= a)
r++;
printf("\n\n\tAnswer is : %d ",r-1);
}
Have a Nice time!!(Note : It's for Integers!! ie, i've not taken floating point division to easy the task!!)
Member • Jan 11, 2011
Member • Jan 12, 2011
Member • Jan 13, 2011