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
How does pointer work in c?
What is meant by high-order and low-order bytes?
What is the right way to use errno?
What are all different types of pointers in c?
Do array subscripts always start with zero?
How can you determine the size of an allocated portion of memory?
What is the total generic pointer type?
Can you write a programmer for FACTORIAL using recursion?
What does %p mean c?
Explain what does the characters 'r' and 'w' mean when writing programs that will make use of files?
What is the best organizational structure?
Difference between constant pointer and pointer to a constant.
What are the two types of structure?
The difference between printf and fprintf is ?
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above