From the course: Complete Guide to C Programming Foundations
Unlock the full course today
Join today to access over 24,300 courses taught by industry experts.
Chapter challenge: Adding variables and constants - C Tutorial
From the course: Complete Guide to C Programming Foundations
Chapter challenge: Adding variables and constants
(light music) - [Instructor] Time to put your variable and constant declaration skills to work. I'm providing this source code skeleton for you found in the exercise files. Your task is to replace the comments with proper C language statements, declarations here, assignments here, and output statements here. The text is provided in the double quote part of each comment. Your task is to replace the comments with C statements. First, declare the constant and variables of the proper data types. The suggested names are shown in the comments. Then assign values to the variables. Finally, output the values as shown in the last set of comments. Here are some hints, the constant value must be equal to three quarter. The variable values can be whatever you like. No math is performed. Real number output formatting is hinted at in the comments though you can use whatever format you like. This challenge should take you about five minutes to complete.
Contents
-
-
-
-
Understanding C language data types3m 17s
-
(Locked)
Declaring variables2m 53s
-
(Locked)
Working with variables3m 4s
-
(Locked)
Exploring the printf() function3m 48s
-
(Locked)
Using constants2m 58s
-
Challenge: Making variables and constants53s
-
(Locked)
Solution: Making variables and constants1m 16s
-
(Locked)
Understanding variable scope3m 35s
-
(Locked)
Making new data types3m 25s
-
(Locked)
Specifying characters and strings3m 17s
-
(Locked)
Specifying integers and real numbers3m 55s
-
(Locked)
Typecasting a variable2m 20s
-
(Locked)
Chapter challenge: Adding variables and constants1m 10s
-
(Locked)
Chapter solution: Adding variables and constants2m 7s
-
-
-
-
-
-
-
-
-
-