program to get the remainder and quotant of given two
numbers with out using % and / operators?
Answer Posted / babitha
# include <stdio.h>
# include <conio.h>
void main()
{
unsigned int dividened,divisor,quotient=0,remainder;
printf("\nenter a dividened");
scanf("%d",÷ned);
printf("\n enter a divisor");
scanf("%d",&divisor);
while(dividened >divisor)
{
quotient++;
dividened=dividened-divisor;
}
if(dividened==divisor)
{
remainder=0;
quotient++;
}
else
{
remainder=dividened;
}
printf("\n quotient of %d / %d is %d",
(quotient*divisor+remainder),divisor,quotient);
printf("\n remainder of %d / %d is %d",
(quotient*divisor+remainder),divisor,remainder);
getch();
}
| Is This Answer Correct ? | 13 Yes | 12 No |
Post New Answer View All Answers
Explain how can I right-justify a string?
Which is best linux os?
What is the maximum length of an identifier?
Explain what is the difference between the expression '++a' and 'a++'?
what are # pragma staments?
What is the use of printf() and scanf() functions?
Are the expressions * ptr ++ and ++ * ptr same?
any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above
Write a Program to accept different goods with the number, price and date of purchase and display them
What is the use of static variable in c?
Why c language?
Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.
What does dm mean sexually?
What is sizeof array in c?
What are the back slash character constants or escape sequence charactersavailable in c?