Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- double celsiustofahrenheit(double c)
- {
- return (((9*c)/5)+32);
- }
- double fahrenheittocelsius(double f)
- {
- return (((f-32)*5)/9);
- }
- int main()
- {
- char g;
- double c,f;
- scanf("%c",&g);
- if(g=='f' || g=='F'){
- scanf("%lf",&f);
- printf("Celsius = %.4lf\n",fahrenheittocelsius(f));
- }
- else{
- scanf("%lf",&c);
- printf("Fahrenheit = %.4lf\n",celsiustofahrenheit(c));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement