Course Content
C Basics
C Basics
Printf Practice
Example: Using Format Specifiers and Variables in Printing
main
#include <stdio.h> int main() { int iVariable = 832; float fVariable = 54.984; char cVariable = '#'; printf(" iVariable = %d \n fvariable = %f \n cVariable = %c \n", iVariable, fVariable, cVariable); return 0; }
Task
Swipe to show code editor
- Assign the value of
100
to the variable namedintVariable
. - Choose an appropriate data type for the variable
charVariable
. - Utilize the
printf()
function to display the values of both variables in a single call.
Once you've completed this task, click the button below the code to check your solution.
Solution
Switch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?
Thanks for your feedback!
Section 2. Chapter 8
Printf Practice
Example: Using Format Specifiers and Variables in Printing
main
#include <stdio.h> int main() { int iVariable = 832; float fVariable = 54.984; char cVariable = '#'; printf(" iVariable = %d \n fvariable = %f \n cVariable = %c \n", iVariable, fVariable, cVariable); return 0; }
Task
Swipe to show code editor
- Assign the value of
100
to the variable namedintVariable
. - Choose an appropriate data type for the variable
charVariable
. - Utilize the
printf()
function to display the values of both variables in a single call.
Once you've completed this task, click the button below the code to check your solution.
Solution
Switch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?
Thanks for your feedback!
Section 2. Chapter 8
Switch to desktop for real-world practiceContinue from where you are using one of the options below