#include <stdio.h>

int cubo(float x) {
    float q;
    q=x*x*x;
    return q;
}

void main() {
    float q,x;
    for(x=0.0; x<=20.0; x=x+0.5) {
        q=cubo(x);
        printf("%.2f ---> %.2f\n", x,q);  //il float ammette 6 cifre dopo la virgola, con il .2 (0.2) divetano 2
                                          // %f è la direttiva di formattazione del float
    }
}

Embed on website

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