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
Explain bitwise shift operators?
What is wrong with this declaration?
What is a nested loop?
What is an array? What the different types of arrays in c?
What is the advantage of using #define to declare a constant?
What do you mean by keywords in c?
GIVEN A FLOATING POINT NUMBER HOW IS IT ACTUALLY STORED IN MEMORY ? CAN ANYONE EXPLAIN?? THE 32 BIT REPRESENTATION OF A FLOATING POINT NUMBER ALLOTS: 1 BIT-SIGN 8 BITS-EXPONENT 23 BITS-MANTISSA
What are the characteristics of arrays in c?
What’s the special use of UNIONS?
What is build process in c?
What are the string functions? List some string functions available in c.
Why is C language being considered a middle level language?
How can I remove the leading spaces from a string?
What is signed and unsigned?
Explain what does a function declared as pascal do differently?