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
Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record
How can you increase the size of a dynamically allocated array?
What is restrict keyword in c?
What is a null string in c?
How can you be sure that a program follows the ANSI C standard?
Why do we need volatile in c?
Explain how can I right-justify a string?
Write a program on swapping (100, 50)
Explain can you assign a different address to an array tag?
What are the different types of control structures in programming?
When a c file is executed there are many files that are automatically opened what are they files?
Are there namespaces in c?
Explain what is a program flowchart and explain how does it help in writing a program?
Write programs for String Reversal & Palindrome check
What is multidimensional arrays