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",÷nd,&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
Write a Program to accept different goods with the number, price and date of purchase and display them
Compare interpreters and compilers.
What will the code below print when it is executed? int x = 3, y = 4; if (x = 4) y = 5; else y = 2; printf ("x=%d, y=%d ",x,y);
What are the parts of c program?
What is variable and explain rules to declare variable in c?
explain what is fifo?
What is const volatile variable in c?
Explain how do you search data in a data file using random access method?
What does double pointer mean in c?
Once I have used freopen, how can I get the original stdout (or stdin) back?
What is the explanation for modular programming?
Explain what is wrong with this program statement?
why programs in c are running with out #include
What is a rvalue?
Where are the auto variables stored?