Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 EXERCISE IN CLASS CHAPTER 3

2 PART 1 IDENTIFIER

3 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 123-45-6789 Determine which of the following are valid identifiers. If invalid, explain why.

4 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:

5 PART 1 BASIC DATA TYPE

6 SCENARIO 1 Write appropriate declarations and assign the given initial values for each group of variables: Floating-point variables: a = -8.2, b = 0.005 Integer variables: x = 129, y = 87, z = -22 Character variables : c1 = ‘w’, c2 = ‘&’

7 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.”); }

8 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; }

9 THAT’S ALL FOR TODAY…… SEE YA NEXT CLASS


Download ppt "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."

Similar presentations


Ads by Google