• Call Us: +91 9437911966
  • Email Us: info@studentstutorial.com
  • Home
  • C Examples
  • Server Side
    • PHP
    • Java
    • CodeIgniter
    • Laravel
    • JSP
    • JDBC
  • Frontend
    • HTML
    • CSS
    • Javascript
    • jQuery
    • AJAX
    • FPDF
    • TCPDF
  • APP & DB
    • Android
    • Cordova
    • SQL
    • Oracle
  • Project
C Tutorial C Introduction C Characteristic C Comments C Operator C Assign Operator C Arithmetic Oper.. C Logical Operator C Modulus Operator C Variable C Initialise Variable C Print F C Translators C Programming C Control Flow C If Else Statement C Nested If Else C Loops C While Loops C For Loops C Do While C Nested Loops

Modulus Operators

  • Students Tutorial
  • 08 jun 2020
   

Modulus Operators (%); -

This operator returrns remainder value.

Remainder value means the part which is not divisible in modulus operator- Return value sign depends only on numeric value.

When the numerator value is less than half dominator value then return value is numerator value only.

A= 15% 3;  0
A= 21% 2;  1
A= 12/ 8;  4
A= 16% 1;  0
A= 27% 7;  6



Value Return Values
47% 5 2
47% -5 -2
-47% -5 2
5% 1
2% 5 2
2.0/5 0.4
-5/2 -2

A= 12.0 + 5/6 % 2;

When we are working with modulus operator, 2 arguments are required and bo.

  • We can’t apply it for float data type.
  • In implementation when we require to calculate remainder value of float data type then go for f mod ( ) or F mod ( ) function which is declased in < stalib.h>.

Value = F mod (n, d);
// return type is double data byte
	  Value= F mod (n, d);
// return type is long double data type
A= 158%10;    8
A= 158%10;    15
A= 104%10;     4
A= 1048/1o;   10
A= 86% 10;     6
A= 23% 10;     3
A= 23/10;      2



  • % 10 always provides last digits of input value.
  • Divided by 10 always removes last digit of input values.
Student Tutorial is a online tutorial for web design and development. Here you can find easy example and explanation for each tutorial.
Copyright © 2016-2023 Student Tutorial

Server Side

  • PHP
  • Java
  • CodeIgniter
  • Laravel
  • JSP
  • JDBC

Frontend

  • HTML
  • CSS
  • Javascript
  • jQuery
  • AJAX
  • FPDF

App & Database

  • Android
  • Cordova
  • SQL
  • Oracle