Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

program to get the remainder and quotant of given two
numbers with out using % and / operators?

Answer Posted / venkat raj

#include<stdio.h>
#include<conio.h>



int remainder;

void main()
{
int dividend, divisor;
int quotient;
int division(int,int);

printf("Enter the value of Dividend and Divisor\n");
scanf("%d %d",&dividend,&divisor);


quotient = division(dividend,divisor);

printf("The Quotient is %d\n",quotient);
printf("The Remainder is %d\n",remainder);

}

int division(int dividend,int divisor)
{

int quotient=0,tempdivisor = divisor;


if(dividend == divisor)
{

remainder=0;
return 1;
}
else if (dividend < divisor)
{

remainder=1;
return 0;
}

while(tempdivisor <= dividend)
{
tempdivisor = tempdivisor + divisor;
quotient = quotient++;
}
remainder=dividend-(tempdivisor-divisor);



return quotient;



}

Is This Answer Correct ?    18 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Given an array of 1s and 0s arrange the 1s together and 0s together in a single scan of the array. Optimize the boundary conditions?

1442


What is the difference between text and binary modes?

1126


How can I rethow can I return a sequence of random numbers which dont repeat at all?

1147


How can I change the size of the dynamically allocated array?

1092


What are the types of arrays in c?

1095


How can I recover the file name given an open stream?

946


Can you please explain the difference between malloc() and calloc() function?

1050


What is a double c?

941


to find the closest pair

2288


Which operators cannot be overloaded a) Sizeof b) .* c) :: d) all of the above

1095


How can I invoke another program (a standalone executable, or an operating system command) from within a c program?

1131


What type is sizeof?

996


Give the rules for variable declaration?

1114


What is malloc return c?

976


What is the mean of function?

1064