Sunday, November 13, 2016

How to find remainder without using MODULUS OPERATOR in C

How to find remainder without using MODULUS OPERATOR in C


Here is the source code for finding remainder without using MODULUS OPERATOR in C Language


 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include<stdio.h>
int main()
{
int a,b,c;
printf("Enter 1st no ");
scanf("%d",&a);
printf("Enter 2nd no ");
scanf("%d",&b);
c=a/b;
c=c*b;
b=a-c;
printf("The remainder is %d ",b);

return 0;


}

Output-


Available link for download