Friday, October 16, 2015

Find Remainder Without Modulo operation in C - Working Code

#include<stdio.h>
#include<conio.h>
void main()
{
    int n1, n2, quotient, remainder;
    clrscr();
    printf("Enter two numbers \n");
    scanf("%d%d",&n1,&n2);
    quotient = n1/n2;
    remainder = n1 - quotient * n2;
    printf("%d",remainder);
    getch();
}


To Compile Press Alt+f9 
To Run Press Ctrl+f9

Output:


No comments:

Post a Comment