{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

practice_problems_mid1

practice_problems_mid1 - ECE 175 Computer Programming for...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
ECE 175: Computer Programming for Engineering Applications Page 1 of 3 Basics of the C language 1. Write the Unix command that will compile a C program named numbers.c with the option to use the debugger and linking the math library (1 pt). 2. D efine a constant named VAR1 and assign it the value of 10 (1 pt). 3. Which of the following names are valid variable names? (4 pts). a. Var1 b. 3table c. char d. _Y_ 4. What is the output of the following block of code? (2 pts). { int x = 6, y = 9; x = x + y; y = y x; x = y/x; printf(“%d \ t %d”, x, y); } 5. Write an if statement that checks whether an integer number x is even and a multiple of 5. If so, it prints “Number x is even and a multiple of five”, else it prints “Not the right number” (2 pts). 6. What values are being assigned to x in the following block of code at each line when y=15.0 (5 pts)? x = 25.0; if (y!=(x-10)) { x = x-10.0;} else { x = x/2.0;}
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
ECE 175: Computer Programming for Engineering Applications Page 2 of 3 7. Consider the following block of code int i = 18, x = 1; while(i>1) { x=x*i; i=i/2; }
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}