From the course: C Essential Training
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Challenge: Get the order correct - C Tutorial
From the course: C Essential Training
Challenge: Get the order correct
(upbeat music) - [Instructor] Your challenge is to get the order correct in a C language mathematical expression. You've been hired as a programmer at a museum that's raised enough money to afford its own programmer. Your task is to write a program that calculates the total number of artifacts in the museum. Use the code from exercise file 03_06 challenge1 to get started. Here are the details. The museum has 12 rooms. Each room has 16 paintings and 4 sculptures. Write an equation that calculates the number of artifacts in the museum and outputs the result. I could offer a hint. The proper result is 240, not 196. This challenge should take you about 10 minutes to complete.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Working with math operators3m 3s
-
Challenge: Do some math49s
-
Solution: Do some math1m 29s
-
Using assignment operators1m 44s
-
Obeying the order of precedence3m 13s
-
Challenge: Get the order correct54s
-
Solution: Get the order correct1m 11s
-
Working with relational operators3m 39s
-
Using logical operators3m 49s
-
Understanding bitwise operators3m 36s
-
Shifting bits3m 18s
-
Exploring unary operators3m 44s
-
Challenge: Binary math1m 5s
-
Solution: Binary math2m 11s
-
-
-
-