SI 204 Spring 2017 / HWs


Homework 11: fprintf

Name: _____________________________________________ Alpha: ___________________

Describe help received: ________________________________________________________

  • Due before class on Monday, February 6
  • This homework contains code to be submitted electronically. Put your code in a folder called hw11 and submit using the 204sub command.
  • This is an electronic homework and you do not need to print out anything to turn in during class.

Assignment

  1. Required reading: Sections 1 (Streams) and 2 (Format strings and fprintf) from the Unit 4 notes,
  2. Write a program called timestwo.c that reads an integer \(n\) from the user and prints out that number times two as follows:
    roche@ubuntu$ ./timestwo
    Enter n: 14
    2 * 14 = 28.

    You must use a `fprintf` statement to produce the output line! Don't forget to put a period `.` and a newline at the end of the last line.

  3. Spend time making some real progress on the project.