Write a program to accept numerator and denominator and find the remainder without using modulus (%) operator using do..while loop.
/* Write a program to accept numerator and denominator and
find the
remainder without using modulus (%) operator
using
do..while loop.*/
#include
<stdio.h>
void main()
{
int
num,den;
printf("Enter the numerator : ");
scanf("%d",&num);
printf("Enter the denominator :
");
scanf("%d",&den);
do
{
num-=den;
}while(num>=den);
printf("The remainder is
%d\n",num);
getch();
}
Comments
Post a Comment