COMP 217 Lab 2

Points: 25 Due Date: Friday April 9, 2004

This program will calculate the squares of a series of numbers. First, the user will enter a maximum square. Then the program will repeatedly ask the user for a number. It will calculate the square. It will print the original number and the square. It will contimue this until the calculated square is larger than the maximum the user entered.

The inputs are the maximum square and the series of numbers.

The outputs are a table of values with each line containing the user entered number and the square.

Hint:look at the break statement.

The purpose of this assignment is to practice writing a small, simple C program and using the compiler.

Here are a couple of sample runs. Your output doesn't have to look exactly like this.

-->./lab2
Enter the maximum square 100
Number  Square
Enter a number to be squared 1
1       1
Enter a number to be squared 3
3       9
Enter a number to be squared 4
4       16
Enter a number to be squared 10
10      100
Enter a number to be squared 11
All done

-->./lab2
Enter the maximum square 100
Number  Square
Enter a number to be squared 22
All done

Deliverables:

I only need the .c file. You don't need to send me the executable file or the output.

Notes


ASK if you have any questions. Or if you get error messages that you don't understand. If you are getting stuck, call or email me.