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
What is string function c?
How old is c programming language?
Which is an example of a structural homology?
What is gets() function?
What is the role of this pointer?
What are the types of pointers?
How can you restore a redirected standard stream?
Why is c used in embedded systems?
The difference between printf and fprintf is ?
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
What are the types of c language?
How main function is called in c?
Describe the header file and its usage in c programming?
What is realloc in c?
What is the 'named constructor idiom'?