Skip to content

BlinkFTW/CS211_Lab2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

CS211_Lab2

Lab assignment TWO from Programming for Engineers I in C

Part A/B

Create a new directory and copy the file skeleton.c, into it. Rename skeleton.c to lab2.c. Then, write a Makefile which will compile, assemble and link this file into an executable called "lab2". Do not forget to add "-Wall" to each gcc command. Then, run "make" from within that directory and be sure your Makefile works.

Add C code to your .c file where my comments indicate it should go to perform all of the following tasks:

Create three integers, named joe, frank and bob. Initialize joe to 56 times 29. Assign bob equal to joe divided by 3. Assign frank equal to the difference between joe and bob. Print the values for all three variables to the screen. Assign bob and joe to be equal to frank. Print the values for all three variables to the screen again. Get a new value for joe from the user with scanf(). Print the value of bob to the screen a total of joe times. Be sure your output makes it clear which numbers are which each time you print them.

Part C

Create a new function which will return the greatest even number less that the value of the single argument passed to the function. Add code to your main C function (to the end of the code you wrote for part B) which prints the results of this function with a few test cases you come up with yourself. Try to pick test cases that test all the potential "corner cases" this function might have.

About

Lab assignment TWO from Programming for Engineers I in C

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages