Printf Practice
Example: Using Format Specifiers and Variables in Printing
main.c
123456789101112#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; }
Oppgave
Swipe to start coding
- 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.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 2. Kapittel 8
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Awesome!
Completion rate improved to 2.63
Printf Practice
Sveip for å vise menyen
Example: Using Format Specifiers and Variables in Printing
main.c
123456789101112#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; }
Oppgave
Swipe to start coding
- 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.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Awesome!
Completion rate improved to 2.63Seksjon 2. Kapittel 8
single