Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Lab 8 - Relational and Logical Operators and if Statements | BIF 101, Lab Reports of Bioinformatics

Material Type: Lab; Class: Intro to Bioinformatics; Subject: Bioinformatics; University: Canisius College; Term: Fall 2008;

Typology: Lab Reports

Pre 2010

Uploaded on 08/19/2009

koofers-user-bsa
koofers-user-bsa 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
BIF 101 Lab 8 – relational and logical operators and if statements (ch 5-6)
Assigned: November 6, 2008
Due: November 13, 2008
For each of the following write (1) an algorithm and (2) a program to solve the given
problem. Test your program on at least 5 sets of input, paste your code and the test values
and results into a word file that you will submit.
1. compare2.pl
Input two numbers and print them out with the smallest first.
2. compare3.pl
Input 3 numbers and print them out in order from smallest to largest.
3. name.pl
Input a name and output “match” if it’s your first name otherwise output “no match”.
4. compstrings.pl
Input two strings and check for and print messages as follows:
Print the two strings
Check to see if they are equal, if so print “same” otherwise print “different”
Check to see if the first is greater than the second, if so print “first is larger”
Check to see if the second is greater than the first, if so print “second is larger”
5. divzero.pl
Input two numbers and divide the first by the second. Test to see what happens when the
first number is zero and when the second number is zero.
6. checkzero.pl
Input two numbers, if the second is zero print a message that you can not perform division
by zero, otherwise divide the first by the second and print the result, also compute and print
the result of the first number modulus (%) the second.
7. positive.pl
Input two numbers, if both are > 0 print “both positive”, if only one is > 0 print “one
positive”, if both are zero print “both zero”, if both are negative print “both negative”, if one
is negative print “one negative”, if one if zero print “one zero”.
Page 98 Going Back for More: exercises 2 and 3

Partial preview of the text

Download Lab 8 - Relational and Logical Operators and if Statements | BIF 101 and more Lab Reports Bioinformatics in PDF only on Docsity!

BIF 101 Lab 8 – relational and logical operators and if statements (ch 5-6)

Assigned: November 6, 2008 Due: November 13, 2008

For each of the following write (1) an algorithm and (2) a program to solve the given problem. Test your program on at least 5 sets of input, paste your code and the test values and results into a word file that you will submit.

  1. compare2.pl

Input two numbers and print them out with the smallest first.

  1. compare3.pl

Input 3 numbers and print them out in order from smallest to largest.

  1. name.pl

Input a name and output “match” if it’s your first name otherwise output “no match”.

  1. compstrings.pl

Input two strings and check for and print messages as follows: Print the two strings Check to see if they are equal, if so print “same” otherwise print “different” Check to see if the first is greater than the second, if so print “first is larger” Check to see if the second is greater than the first, if so print “second is larger”

  1. divzero.pl

Input two numbers and divide the first by the second. Test to see what happens when the first number is zero and when the second number is zero.

  1. checkzero.pl

Input two numbers, if the second is zero print a message that you can not perform division by zero, otherwise divide the first by the second and print the result, also compute and print the result of the first number modulus (%) the second.

  1. positive.pl

Input two numbers, if both are > 0 print “both positive”, if only one is > 0 print “one positive”, if both are zero print “both zero”, if both are negative print “both negative”, if one is negative print “one negative”, if one if zero print “one zero”.

Page 98 Going Back for More: exercises 2 and 3