A煤n no tienes acceso a esta clase

Crea una cuenta y contin煤a viendo este curso

Operadores relacionales

12/26
Recursos

Aportes 13

Preguntas 1

Ordenar por:

驴Quieres ver m谩s aportes, preguntas y respuestas de la comunidad? Crea una cuenta o inicia sesi贸n.

Tabla:

SIMBOLOS CODIGO ASCII


Mayor que
alt + 62
馃崟 > 馃エ


Menor que
alt + 60
馃懚馃徑< 馃懙馃徑


Igual
alt + 61
馃憠馃徑=馃憟馃徑


Negaci贸n
alt + 33
馃檪 ! 馃檭

paso a paso鈥 entrando al mundo C#鈥

Otra forma es colocando los valores directamente en el texto para apreciar los numeros que se estan comparando:

Console.WriteLine($"驴El numero {valor1} es igual al numero{valor2}?: {result1}");

Operadores relacionales


== Igual a
!= No igual a 
> Mayor que
< Menor que
>= Mayor o igual que
<= Menor o igual que 

Buenas, combine un poco los operadores relacionales basicos con el futbol ingles. Espero les sirva mi aporte.

//Cantidad de Champions League futbol ingles, quien tiene mas

int liverpool = 6;
int man_united = 3;
int chelsea = 2;

if (liverpool > man_united && liverpool > chelsea) ;
    Console.WriteLine("El Liverpool es el que tiene mas UCL de los tres");

if (man_united > chelsea) ;
    Console.WriteLine("El Manchester united tiene mas UCL que el Chelsea");

if (chelsea < man_united && chelsea < man_united)
    Console.WriteLine("El Chelsea es el que tiene menos UCL de los tres");
Console.WriteLine("Hello, World!");

int value1 = 18;
int value2 = 18;
int value3 = -18;

bool result0=value1 == value2;
Console.WriteLine("The result of value 1 == value2 is: " + result0);
bool result1 = value1 != value2;
Console.WriteLine("The result of value 1 != value2 is: " + result1);
bool result2 = value1 > value2;
Console.WriteLine("The result of value 1 > value2 is: " + result2);
bool result3 = value1 < value2;
Console.WriteLine("The result of value 1 < value2 is: " + result3);
bool result4 = value1 >= value2;
Console.WriteLine("The result of value 1 >= value2 is: " + result4);
bool result5 = value1 <= value2;
Console.WriteLine("The result of value 1 <= value2 is: " + result5);

goood

Documentaci贸n oficial de C#

Operadores de comparaci贸n

Hice otro ejercicio, esta vez con las ligas ganadas por el liverpool y el manunited, espero les sirva mi aporte, saludos.

//Number of leagues won by liverpool and manunited

int man_united = 20;
int liverpool = 18;

bool result1 = man_united == liverpool;
Console.WriteLine("They have won THE SAME number of league titles: " + result1);

bool result2 = man_united != liverpool;
Console.WriteLine("They have won DIFFERENT NUMBER of league titles: " + result2);

bool result3 = man_united > liverpool;
Console.WriteLine("Manchester United have won MORE league titles than liverpool: " + result3);

bool result4 = man_united >= liverpool;
Console.WriteLine("Manchester United have won MORE OR THE SAME league titles than liverpool: " + result4);

bool result5 = man_united < liverpool;
Console.WriteLine("Manchester United have won LESS league titles than liverpool: " + result5);

bool result6 = man_united <= liverpool;
Console.WriteLine("Manchester United have won LESS OR THE SAME league titles than liverpool: " + result6);

Repasando ando

int value1 = 3;
int value2 = 18;
int value3 = -18;

Console.WriteLine(
    "The value of Value1 is: " + value1);
Console.WriteLine(
    "The value of Value2 is: " + value2);
Console.WriteLine(
    "The value of Value3 is: " + value3);
bool result0 = value1 == value2;
bool result1 = value1 != value2;
bool result2 = value1 > value2;
bool result3 = value1 < value2;
bool result4 = value1 >= value2;
bool result5 = value1 <= value2;
Console.WriteLine(
    "The result of (value1 == value2) is: " + result0 + "\n ");
Console.WriteLine(
    "The result of (value1 != value2) is: " + result1 + "\n ");
Console.WriteLine(
    "The result of (value1 > value2) is: " + result2 + "\n ");
Console.WriteLine(
    "The result of (value1 < value2) is: " + result3 + "\n ");
Console.WriteLine(
    "The result of (value1 >= value2) is: " + result4 + "\n ");
Console.WriteLine(
    "The result of (value1 <= value2) is: " + result5 + "\n ");

Keep and Calm
Pause the video and complete the exercise

Like!

Los operadores relacionales y de igualdad binarios comparan el primer operando con el segundo para probar la validez de la relaci贸n especificada. El resultado de una expresi贸n relacional es 1 si la relaci贸n probada es true y 0 si es false