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
a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);
The statement, int(*x[]) () what does in indicate?
What are the storage classes in C?
What is your stream meaning?
What are the primitive data types in c?
What are valid signatures for the Main function?
Can I initialize unions?
write a program to copy the string using switch case?
What is string in c language?
while initialization of array why we use a[][2] why not a[2][]...?
What is the difference between exit() and _exit() function?
Write a program to generate the Fibinocci Series
What is memory leak in c?
Where are the auto variables stored?
What is a const pointer in c?