SI 204 Spring 2017 / HWs

Homework 05: If intro

Name: _____________________________________________ Alpha: ___________________

Describe help received: ________________________________________________________

  • Due before class on Monday, January 23
  • This homework contains code to be submitted electronically. Put your code in a folder called hw05 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.


  1. Required reading: Sections 5 (Expressions and Statements) and 6 (Branching) from the Unit 2 notes.
  2. Write a program in a file called sleeping.c that reads a 4-digit time (HHMM, 24-hour time), and prints out "Awake" if the time is between 0600 and 2300 (inclusive), and "Asleep" otherwise.

    Example of running your program:

    roche@ubuntu$ ./sleeping
    Time: 0330
    roche@ubuntu$ ./sleeping
    Time: 1650
    roche@ubuntu$ ./sleeping
    Time: 2301