High Performance Computing

Project 1 (Introduction to C)

TASK: Write two serial (non-parallel) C programs, one called convert.c and one called print.c.

Part 1: convert.c

Here’s what you need to do:

  1. Ask for a ‘start’ value
  2. Ask for an ‘end’ value
  3. Ask for a ‘step’ value
  4. Print out all the Celsius values between the starting and ending value in ‘step’ steps
  5. Print out the corresponding Fahrenheit values next to each Celsius value (in a nice table format)

An example run of the program might look like this when running ./convert:

Please enter a lower bound: 10
Please enter an upper bound: 20
Please enter a step value: 4

Celsius         Fahrenheit
-------         ----------
10.000000       50.000000
14.000000       57.200000
18.000000       64.400000

Part 2: print.c

Here’s what you need to do:

  1. From the command line (when you run the program), take in both a string and an integer
  2. Print the given string the number of times as the integer specifies, one string per line

An example run of the program might look like this when running ./print hello 5:

hello
hello
hello
hello
hello

Documentation

You should also document/comment your code. At the top of your source code file, give a description of the program, the author of the code, and the date the code was written. Also place comments throughout your program (you can decide when you have enough comments, but they should adequately describe your code).

Submit

Save your programs as convert.c and print.c, and submit them both on Moodle by the due date at 11:59PM.