Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Printf Practice | Data
C Basics

book
Printf Practice

Example: Using Format Specifiers and Variables in Printing

main.c

main.c

copy
#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;
}
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; }
Taak

Swipe to start coding

  • Assign the value of 100 to the variable named intVariable.
  • Choose an appropriate data type for the variable charVariable.
  • Utilize the printf() function to display the values of both variables in a single call.

Oplossing

#include "stdio.h"

int main()
{
int intVariable = 100;
char charVariable = '$';

printf("%d %c", intVariable, charVariable);

return 0;
}
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 8
single

single

#include "stdio.h"

int main()
{
int intVariable = ___;
___ charVariable = '$';

printf("___", intVariable, charVariable);

return 0;
}

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

We use cookies to make your experience better!
some-alt