Você está na página 1de 2

OPERADORES ARITMETICOS

//Adio
8 + 7; //Retoma 15
1.5 + 2.5; //Retoma4
//Subtrao
5 2; //Retorna 3
20 2.7; // Retorna 17.3
4 - (-3); //Retorna7
//Multiplicao
7 * 0.3; //Retorna 2.1
(-5) * (-2); //Retorna 10
2.87 * 0; //Retorna 0
//Diviso
7 / 2; //Retorna 3
7D / 2D; //Retorna 3.5

7 == 3 + 4; //Retorna true
7 == 3 4; //Retorna false
//Maior
9 > 7; //Retorna true
10 + 3 > 12 + 2; //Retorna false
10 + 3 > 12 + 1; //Retorna false
//Menor
-5 < 0; //Retorna true
10.5 < 10.2; //Retorna false
7/3 < 7 % 2; //Retorna false
//Maior ou igual
6 >= 7; //Retorna false
7 >= 7; //Retorna true
8 >= 7; //Retorna true
//Menor ou igual

8 / 3; //Retorna2

7 <= 2 + 3; //Retorna false

8 / 3D; //Retorna
2.666656666666667

7 <= -7.4; //Retorna false


7 <= 7; //Retorna true

7D / 2D; //Retorna 3.5


8 / (-4); //Retorna -2
8 / 2; //Retorna 4
//Resto da diviso

//Diferente
10 != 10; //Retorna false
20 != 12; //Retorna true
(-4) != 4; //Retorna true

11 % 2; //Retorna 1
10 % 2; //Retorna 0
6 % 4; //Retorna 2
6 % 3; //Retorna 0
OPERADORES RELACIONAIS
//Igual
0 == 0; //Retorna true

3%2 != 5%2; //Retorna false

OPERADORES LGICOS
//Negao
!(10 > 3); //Retorna false
!true; //Retorna false
!(0 == 0); //Retorna false
!(0 != 0); //Retorna true
//Conjuno

7 > 5 && 4 > 3; //Retorna true


7 > 5 && 4 == 1; //Retorna false
3 * 2 == 6 && 7 != 6 + 1;
//Retorna false
//Disjuno
7 > 5 || 4 > 3; //Retorna true
3 * 3 == 6 || 7 != 6 + 1; //Retorna
false

Você também pode gostar