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 are the rules for identifiers in c?
How can you convert integers to binary or hexadecimal?
What is the -> in c?
Why do we use pointer to pointer in c?
What is the difference between functions getch() and getche()?
Is c high or low level?
What is the 'named constructor idiom'?
What is the use of void pointer and null pointer in c language?
Explain how do you determine the length of a string value that was stored in a variable?
Can you add pointers together? Why would you?
Is it valid to address one element beyond the end of an array?
any C program contains only one function, it must be a) void () b) main () c) message () d) abc ()
What are identifiers c?
what is the different bitween abap and abap-hr?
What is malloc and calloc?