EXERCISE IN CLASS CHAPTER 3
PART 1 IDENTIFIER
SCENARIO 1 o record1 o 1record o file_3 o return o $tax o Name o name and address o name-and-address o name_and_address o Determine which of the following are valid identifiers. If invalid, explain why.
SCENARIO 2 #include void main() { int 1st, second, third; float fun, Fun; char x, initial name, my-name; Second = 8; Fun=10.2 fun = x; } Trace all the syntax error(s) in below program:
PART 1 BASIC DATA TYPE
SCENARIO 1 Write appropriate declarations and assign the given initial values for each group of variables: Floating-point variables: a = -8.2, b = Integer variables: x = 129, y = 87, z = -22 Character variables : c1 = ‘w’, c2 = ‘&’
SCENARIO 2 Identify the syntactic errors in the following program. Then rewrite the correct program. #include void main() {integer a; floating-point b; character c; printf(“End.”); }
SCENARIO 3 Write the #define preprocessor directive for a program that has the constant macro HOURLY_WAGES (5.50). Rewrite the following program that uses variables with memory constants. #include void main() { float weight = 30.5; int product_code = 1000; }
THAT’S ALL FOR TODAY…… SEE YA NEXT CLASS