DOC PREVIEW
UIUC ECE 190 - ECE120 HW4

This preview shows page 1-2 out of 5 pages.

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

Unformatted text preview:

1. The next step is ISA (Instruction Set Architecture ). ISA is used to translate the program into particular instruction for the computer that will be used to carry out the work of the program.2. int birth_year float height printf ( “Enter your birth year:\n” ) scanf ( “%d” , &birth_year ) printf ( “Enter your height ( in meters ):\n” ) scanf ( “%f” , &height ) printf ( “Your birth year is %d\n” , birth_year ) printf ( “Your height is %f\n” , height)3. a) 0x577C b) 0x444C c) 0xEDBA d) 0x1230 e) 0x04024. a) x>0 x>1 b) True5. a) 5 4 3 2 1 0 0 b) 4 7 10 c) 1*1 = 1 2*2 = 46. a) n n p pb) OR c) A B OUT 0 0 1 0 1 1 1 0 1 1 1 07. a) b) /* * * Factorial!: Computes the factorial of a positive integer * */ #include <stdio.h> int main(){ /* Initialization */ int factorial; /* input to be entered by the user */ int result; /* result, factorial! */ printf("Please enter a number: "); scanf("%d", &factorial); while((factorial < 0) || (factorial > (2^32 - 1)) { printf("Please enter a number again: "); scanf("%d", &factorial); } /* Compute factorial */ result = 1; while(factorial > 0) { result *= factorial; factorial--; } /* Print the answer */ printf("%d\n", result); return 0; } 8. a) Compute integer/2, and determine whether the remainder equals 0. b)c) /* * * Determine whether or not a positive integer d < 2^31 is a power of 2 * */ #include <stdio.h> int main() { /* Initialization */ int factorial; /* input to be entered by the user */ int result; /* result, factorial! */ printf("Please enter a number: "); scanf("%d", &integer); while((integer < 0) || (integer > (2^31)) { printf("Please enter a number again: "); scanf("%d", &integer); } result = integer % 2; if(result = 0) { printf(“ The integer is the power of 2”) } else { printf(“ The integer is not the power of 2”) } return 0;


View Full Document

UIUC ECE 190 - ECE120 HW4

Documents in this Course
Load more
Download ECE120 HW4
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 ECE120 HW4 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 ECE120 HW4 2 2 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?