#include float vypocti_fahr(void) { float fahr, celsius; printf("\nZadejte hodnotu teploty: "); scanf("%f", &fahr); celsius = (5.0/9.0)*(fahr-32.0); return celsius; } float vypocti_cels(void) { float celsius, fahr; printf("\nZadejte hodnotu teploty: "); scanf("%f", &celsius); fahr = ((celsius)/(5.0/9.0)+32.0); return fahr; } int main(void) { char znak; int i; float vysledek = 0; printf("\nTento program slouzi pro konvertaci teplot ze stupnu Fahrenheita na\nstupne Celsia a opacne.\n\n"); do { printf("\nVyberte moznost:\n"); printf("_____________________\n\n"); printf(" 1 - Prevod Fahrenheit - Celsius.\n"); printf(" 2 - Prevod Celsius - Fahrenheit.\n"); printf(" 3 - Konec programu.\n\n"); scanf("%d", &i); switch(i) { case 1 : printf("\nZvolili jste prevod Fahrenheit-Celsius\n"); vysledek = vypocti_fahr(); printf("Vysledek je: %.3f\n", vysledek); break; case 2 : printf("\nZvolili jste prevod Celsius-Fahrenheit\n"); vysledek = vypocti_cels(); printf("Vysledek je: %.3f\n", vysledek); break; case 3 : printf("\nZvolili jste konec programu\n"); break; printf : printf("\nChybna volba\n"); break; } }while(i != 3); return 0; }