Program to find remainder without using modulo or % operator | C # implementation of the approach ; Function to return num % divisor without using % ( modulo ) operator ; While divisor is smaller than n , keep subtracting it from num ; Driver code
using System ; class GFG { static int getRemainder ( int num , int divisor ) { while ( num >= divisor ) num -= divisor ; return num ; } public static void Main ( String [ ] args ) { int num = 100 , divisor = 7 ; Console . WriteLine ( getRemainder ( num , divisor ) ) ; } }