Write a program which asks the user to enter an integer
0 < n <= 20, and then reads in n integers and saves them in an
array. You may assume that the number of elements in the
array will not exceed 20.
On a separate piece of paper, write your name, section
number, and wpi login name. Answer the following question: why
is it considered better programming style to define the
size of an array with a symbol defined in a PARAMETER
statement rather than using an integer constant in the
array declaration? In other words, why is
INTEGER SIZE
PARAMETER (SIZE=20)
INTEGER MyArray(SIZE)
considered better than
INTEGER MyArray (20)
Pass your paper in to the TA.
Edit your program to make it print out the list of numbers
in the array.
Edit your program to determine whether the list is the
same backwards and forwards (this is called a palindrome). (Hint:
see if the first item in the list equals the last item
in the list, the second item equals the next-to-the-last item, and so on
... ). Print out a message telling the user if the array
is a numerical palindrome.
A sample execution of the program might look as follows:
Input n:
8
Input the list:
12 4 56 15 15 56 4 12
The list you entered: 12 4 56 15 15 56 4 12
The list IS a palindrome
Use the 'script' command to record your program running.
Turn in your program and typescript file electronically
by typing in the command
/cs/bin/turnin submit cs1001 lab5 lab5.f90 lab5.script
This document was generated using the LaTeX2HTML translator Version 97.1 (release) (July 13th, 1997)
Copyright © 1993, 1994, 1995, 1996, 1997, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
The command line arguments were:
latex2html lab5.tex.
The translation was initiated by Nitin John on 4/13/2000