Close
Close

explain the working of modulus operator in c with example

   jenny_uppal_1722


Answers

  •   

    Modulus operator just returns the remainder of an integer division. 

    #include <stdio.h>
    
    int main() {
    	printf("%d\n", 4%7 );
    	return 0;
    }
    

    This is a simple example of modulus operator where the remainder of the division of 4 by 7 is returned by the operator.


    • thanks
      - jenny_uppal_1722

Ask Yours
Post Yours
Write your answer