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
The __________ attribute is used to announce variables based on definitions of columns in a table?
If the size of int data type is two bytes, what is the range of signed int data type?
How can I recover the file name given an open stream?
What is the code for 3 questions and answer check in VisualBasic.Net?
What is hash table in c?
#include show(int t,va_list ptr1) { int a,x,i; a=va_arg(ptr1,int) printf(" %d",a) } display(char) { int x; listptr; va_star(otr,s); n=va_arg(ptr,int); show(x,ptr); } main() { display("hello",4,12,13,14,44); }
What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?
When should a type cast not be used?
write a program to find the given number is prime or not
Why is extern used in c?
Can include files be nested? How many levels deep can include files be nested?
What does 1f stand for?
Is it possible to pass an entire structure to functions?
Subtract Two Number Without Using Subtraction Operator
What is define c?