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",&dividened);

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


Please Help Members By Posting Answers For Below Questions

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

4748


How can you increase the size of a dynamically allocated array?

647


What is restrict keyword in c?

647


What is a null string in c?

593


How can you be sure that a program follows the ANSI C standard?

1133






Why do we need volatile in c?

750


Explain how can I right-justify a string?

627


Write a program on swapping (100, 50)

640


Explain can you assign a different address to an array tag?

648


What are the different types of control structures in programming?

661


When a c file is executed there are many files that are automatically opened what are they files?

598


Are there namespaces in c?

570


Explain what is a program flowchart and explain how does it help in writing a program?

653


Write programs for String Reversal & Palindrome check

601


What is multidimensional arrays

637