CSE 3302 Programming Languages

Summer 07

 

Programming project #1 (worth 10% of total grade)

Due June 28th at class time. Turn in the lab by email to the TA. Projects turned in on or before June 21st will receive up to 5 points extra credit.

 

Assignment:

 

Use the g77 compiler on omega and write a Fortran-77 program to solve the problem below. For this lab you are restricted in your use of the Fortran-77 control structures. You may only use DO loops, IF/THEN statements (no ELSE parts), computed or arithmetic IFs as desired, and GOTOs. No other control structures may be used. You are also limited to the basic arithmetic operators (+.-.*,/) to perform the calculations. Do not call any predefined functions to solve the problem below.

 

The problem to solve:

 

Declare an array of 200 integers. Use the Sieve of Eratosthenes algorithm to find the first 200 prime numbers (remember that 1 is not prime) and store them in the array. Then let the user enter two integers, both greater than 100, and find the prime factors for each number. Then find the greatest common factor of the two numbers.

 

When all calculations are complete, print the array of prime numbers as a table with 5 columns, print the first integer entered by the user and its prime factors, print the second integer entered by the user and its prime factors, and the print both integers and their greatest common factor. Use character strings to label your output.

 

You must turn in the following:

1)             Your source code for the program

2)             A script of the program execution and output

3)             A half-page single space write up of what you liked and disliked about using Fortran 77

 

 

Your program will be graded on the quality of the code and the documentation (35%), the correctness and completeness of the program output (50%), and your write up about using the language (15%)

 

Notes:

There are many online references for Fortran 77. A PDF of the ANSI standard can be found at

http://www.fh-jena.de/~kleine/history/languages/ansi-x3dot9-1978-Fortran77.pdf