program to get the remainder and quotant of given two
numbers with out using % and / operators?

Answer Posted / brad

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,r1,r2,count=0;
printf("Enter two numbers\n");
scanf("&d,&d",a,b);
if(a>b)
{
r1=a;
r2=b;
}
else
{
r1=b;
r2=a;
}
do
{
res=r1-r2;
r1=res;
count++;
}
while(r1>=r2);
printf("the remainder is ",res);
printf("the quotient is ",count);
}

Is This Answer Correct ?    3 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is string function c?

561


How old is c programming language?

571


Which is an example of a structural homology?

779


What is gets() function?

666


What is the role of this pointer?

545






What are the types of pointers?

596


How can you restore a redirected standard stream?

606


Why is c used in embedded systems?

606


The difference between printf and fprintf is ?

714


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

4737


What are the types of c language?

551


How main function is called in c?

622


Describe the header file and its usage in c programming?

616


What is realloc in c?

581


What is the 'named constructor idiom'?

636