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

The __________ attribute is used to announce variables based on definitions of columns in a table?

669


If the size of int data type is two bytes, what is the range of signed int data type?

582


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

548


What is the code for 3 questions and answer check in VisualBasic.Net?

1682


What is hash table in c?

567






#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); }

764


What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?

583


When should a type cast not be used?

622


write a program to find the given number is prime or not

3834


Why is extern used in c?

610


Can include files be nested? How many levels deep can include files be nested?

653


What does 1f stand for?

604


Is it possible to pass an entire structure to functions?

550


Subtract Two Number Without Using Subtraction Operator

350


What is define c?

568