Jun 25
  • The ‘%‘ (modulus) operator returns the remainder on dividing one integer with another.
  • This operator cannot be applied on float.
  • On using ‘%‘ the sign of remainder is always same as of numerator.

Example :

5 % 2=1

-5 % 2=-1

5 % -2=1

-5 % -2=-1

  • No operator is assumed to be present.It must be written explicitly.

Example :

a=c.d.b(x.y) (usual arithmetic expression)

a=c*d*b*(x*y) (C  statement)

  • There is no operator for performing exponentiation operation.

Example :

b= 3^ 2 is invalid statement.

If we want to do the exponentiation,we can get it done this way.

Code :

#include<math.h>

main()

{

int a;

a= pow (3,2); /*standard library function*/

printf(”%d”,a);

}

pow()  function is being used to raise 3 to the power  of 2.

Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Blogplay
  • LinkedIn
  • MySpace
  • Reddit
  • RSS
  • Twitter

written by Shweta