Vai al contenuto

Confrontare 2 numeri

Gli operatori di confronto utilizzati con 2 numeri

confronto1

Osserva: solo i confronti che hanno successo vengono visualizzati.


Il codice

TextWindow.Write("Primo numero: ")
num1=TextWindow.ReadNumber()

TextWindow.Write("Secondo numero: ")
num2=TextWindow.ReadNumber()

If(num1 < num2) Then
   TextWindow.WriteLine(num + " < " + num2)
EndIf

If(num1 <= num2) Then
   TextWindow.WriteLine(num1 + " <= " + num2)
EndIf

If(num1 = num2) Then
   TextWindow.WriteLine(num1 + " = " + num2)
Endif

If(num1 > num2) Then
   TextWindow.WriteLine(num1 + " > " + num2)
EndIf

If(num1 >= num2) Then
   TextWindow.WriteLine(num1 + " >= " + num2)
EndIf

If(num1 <> num2) Then
   TextWindow.WriteLine(num1 + " <> " + num2)
EndIf

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.