C Tutorial
#include<stdio.h> #define F_LOW 0 #define F_MAX 50 #define STEP 5 void main() { float fahrenheit, celsius; fahrenheit = F_LOW; printf("Fahrenheit Celsius\n"); while(fahrenheit <= F_MAX) { celsius = (fahrenheit - 32.0)/1.8; printf("%5.1f %7.2f\n", fahrenheit, celsius); fahrenheit = fahrenheit + STEP; } }Output:
$ cc celsius.c $./a.out Fahrenheit Celsius 0.0 -17.78 5.0 -15.00 10.0 -12.22 15.0 -9.44 20.0 -6.67 25.0 -3.89 30.0 -1.11 35.0 1.67 40.0 4.44 45.0 7.22 50.0 10.00
C Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us
| Report website issues in Github
| Facebook page
| Google+ page