programming-examples/perl/Statement/Using if statements with relational and equality operators.pl

33 lines
740 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
print "Please enter first integer: ";
$number1 = <STDIN>;
chomp $number1;
print "Please enter second integer: ";
$number2 = <STDIN>;
chomp $number2;
print "The integers satisfy these relationships: \n";
if ( $number1 == $number2 ) {
print "$number1 is equal to $number2.\n";
}
if ( $number1 != $number2 ) {
print "$number1 is not equal to $number2.\n";
}
if ( $number1 < $number2 ) {
print "$number1 is less than $number2.\n";
}
if ( $number1 > $number2 ) {
print "$number1 is greater than $number2.\n";
}
if ( $number1 <= $number2 ) {
print "$number1 is less than or equal to $number2.\n";
}
if ( $number1 >= $number2 ) {
print "$number1 is greater than or equal to $number2.\n";
}