Log in to add a comment

Log in to add a comment

It also known as modulus operator.

example

#include<iostream.h>

#include<conio.h>

int main()

{

int number;

cout<<"Enter the number";

cin>>number;

if (number%2==0)

{

cout<<"The number is even";

}

else cout<<"The number is odd";

}

output will be like this :

Enter the number

10

The number is even

if we take another number instead the output will be like

Enter the number

5

The number is odd .

since,5%2!=0