Home Python C Language C ++ HTML 5 CSS Javascript Java Kotlin SQL DJango Bootstrap React.js R C# PHP ASP.Net Numpy Dart Pandas Digital Marketing

OutPut:

To output data in C, you typically use the printf() function from the standard input-output library (stdio.h). Here's how you can use it:

#include

int main() {
// Printing a string
printf("Hello, world!\n");

// Printing integer variables
int num = 10;
printf("The value of num is %d\n", num);

// Printing floating-point variables
float pi = 3.14159;
printf("The value of pi is %.2f\n", pi); // %.2f limits the float to 2 decimal places

// Printing characters
char letter = 'A';
printf("The character is %c\n", letter);

// Printing multiple variables
int a = 5, b = 10;
printf("The value of a is %d and the value of b is %d\n", a, b);

return 0; }

In the printf() function:

Remember to include the necessary header file #include <stdio.h> at the beginning of your code to use the printf() function.



Advertisement





Q3 Schools : India


Online Complier

HTML 5

Python

java

C++

C

JavaScript

Website Development

HTML

CSS

JavaScript

Python

SQL

Campus Learning

C

C#

java