#include <stdio.h>

int main(void) {
    float x = 0.59;
    printf("x = %1.0f\n", x); // 0 decimali
    printf("x = %1.1f\n", x); // 1 decimale
    printf("x = %1.2f\n", x); // 2 decimali
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: