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 many bytes is a struct in c?
Write an efficient algo and C code to shuffle a pack of cards.. this one was a feedback process until we came up with one with no extra storage.
What are disadvantages of C language.
What is a lookup table in c?
Can we compile a program without main() function?
Tell us two differences between new () and malloc ()?
What are register variables in c?
how can f be used for both float and double arguments in printf? Are not they different types?
How can I open files mentioned on the command line, and parse option flags?
write a program in c language to print your bio-data on the screen by using functions.
Distinguish between actual and formal arguments.
Why header files are used?
Write a program with dynamically allocation of variable.
Is it cc or c in a letter?
The % symbol has a special use in a printf statement. Explain how would you place this character as part of the output on the screen?