Home

A program to explain formatted output function PRINTF

C Programming Language 005

The following code shows how to write a program to explain formatted output function PRINTF

Program

#include <stdio.h>

void main()
{
    int a = 34;
    float f = 10.85;
    printf("%6d \n", a);
    printf("%-6d \n", a);
    printf("%f \n", f);
    printf("%10.3f \n", f);

    printf("\n");
}

Result

    34
34
10.850000
    10.850


Last Updated on

Next Post: GraphProtocol: TS2322 null assignment in Subgraph →

Comments