Breaking News

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\n");
    scanf("%d",&a);
    printf("Enter 2nd no\n");
    scanf("%d",&b);
    c=a/b;
    c=c*b;
    b=a-c;
    printf("The remainder is %d \n",b);

return 0;


}

Output-

No comments

shankhajana. Powered by Blogger.