DOC PREVIEW
UIUC ECE 120 - Introduction to C programming

This preview shows page 1 out of 2 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Homework 3 solution Regrade requests are due on Friday October 7 at 4 00pm First make sure you have read and understood the Course Overview and Policies then read the Homeworks page and follow the instructions outlined there Introduction to C programming 1 Code transformation Compilation Generally it is the step of translating a high level language program into machine code which can directly be executed on the hardware To do this effectively the compiler must analyze the source program as a larger unit usually the entire source file before producing the translation 2 Basic I O in C float weight or int weight float height float bmi printf Type your weight scanf f weight or scanf d weight printf Type your height scanf f height bmi weight height height its possible that students calculate BMI in another variable printf Your BMI is f n weight height height or printf Your BMI is d n bmi 3 Operators 1 2 3 4 5 0x2036 0x36 0xDFE9 0x2000 0x7E0 4 C Conditional Constructs a First sentence Third sentence b y 3 c No output 5 Range Checking There are multiple solutions One possibility is if ascii 48 ascii 57 ascii 43 ascii 45 printf c ascii simpler yet if ascii 0 ascii 9 ascii ascii printf c ascii 6 Nested Conditional Constructs a x 0 Hello world b False 7 Iterative Constructs a Done b 1 3 4 1 2 3 1 1 2 2 3 5 2 2 4 2 1 3 3 3 6 3 2 5 3 1 4 4 3 7 4 2 6 4 1 5 5 3 8 5 2 7 5 1 6 8 To Read or Not to Read Solve this problem using an EWS Linux machine 1 a does not have the value 0 2 No the program was supposed to output a has value 0 when a has value 0 3 Line 4 4 Use comparison operator instead of assignment operator if a 0 5 a has the value 0


View Full Document

UIUC ECE 120 - Introduction to C programming

Download Introduction to C programming
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Introduction to C programming and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Introduction to C programming and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?