How to Print in C?

Use `printf()` from `stdio.h`

Include the header: `#include `

Print text: `printf(“Hello, World!n”);`

Print an integer: `printf(“%dn”, x);`

Print a float: `printf(“%fn”, y);`

Print a character: `printf(“%cn”, ch);`

Print a string: `printf(“%sn”, str);`

Print multiple values: `printf(“Age: %d, Score: %fn”, age, score);`

Use `n` for a new line

Use `puts()` to print a string with a new line

Use `putchar()` to print a single character

Suggested for You

Trending Today