1234567891011121314151617181920212223242526272829303132333435363738394041424344
#include <stdio.h> float c; float f; float ftoc(float f) //convert fahrenheit to celsius { c=(5/9)*(f-32); return (c); } float ctof(float c) //convert celsius to fahrenheit { f=(9/5)*(c+32); return (f); } main() { int a; printf("To convert Celsius to Fahrenheit, press 1\nTo convert Fahrenheit to Celcius, press 2\n"); scanf("%d", a); if ( a==1 ) { printf("\nEnter the value in Celsius.\n"); scanf("%f", c); ctof; printf("The temperature in Fahrenheit is %f",f); } else if ( a==2 ) { printf("\nEnter the value in Fahrenheit.\n"); scanf("%f", f); ftoc; printf("The temperature in Celsius is %c", c); } else { printf("invalid value"); } getchar(); }
scanf("%f", &c) ;