#include <stdio.h> int main() { float kelvin, celsius; int lower, upper, step; lower=0; upper=300 ; step=10; kelvin=lower; while (kelvin<=upper){ celsius=kelvin-273.15; printf("%.0f Kelvin %.2f Celsius\n", kelvin, celsius); kelvin=kelvin+step; } return 0; }
%.2f means print as a floating point with 2 decimals.
The output is: