mirror of
https://github.com/ada-dmitry/TMP_C712.git
synced 2026-09-24 09:10:16 +00:00
added new task
This commit is contained in:
@@ -4,7 +4,16 @@ float fahr(int cel)
|
||||
{
|
||||
float res;
|
||||
|
||||
res = cel * 9 / 5 + 32;
|
||||
res = (float)cel * 9 / 5 + 32;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
float celsius(int fahr)
|
||||
{
|
||||
float res;
|
||||
|
||||
res = ((float)fahr - 32) * 5 / 9;
|
||||
|
||||
return res;
|
||||
}
|
||||
@@ -1,16 +1,18 @@
|
||||
#include <stdio.h>
|
||||
#include "func.c"
|
||||
|
||||
float fahr(int cel);
|
||||
float celsius(int fahr);
|
||||
|
||||
int main()
|
||||
{
|
||||
int cel; // градусы Цельсия
|
||||
float f; // градусы Фаренгейта
|
||||
int cel; // градусы Цельсия
|
||||
float f, ans; // градусы Фаренгейта
|
||||
|
||||
scanf("%d", &cel);
|
||||
f = fahr(cel);
|
||||
printf("%.2f\n", f); // .2f - печатать с точностью до 2 знаков после .
|
||||
|
||||
ans = celsius((int)f);
|
||||
printf("%.2f\n", ans);
|
||||
return 0;
|
||||
}
|
||||
Executable
BIN
Binary file not shown.
Reference in New Issue
Block a user