Skip to content

Commit a34c7c8

Browse files
committed
celsius_to_farenheit
0 parents  commit a34c7c8

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

ctof.c

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/****************************************************************************
2+
* celsius_to_farenheit.c
3+
* Computer Science 50
4+
* Nataliia Vynogradenko
5+
*
6+
* Convert temperature in Celsius to Farenheit
7+
***************************************************************************/
8+
#include <stdio.h>
9+
#include <cs50.h>
10+
11+
int main(void)
12+
{
13+
// ask user for tempreture in Celsius
14+
printf("Input temperature in Celsius:\n");
15+
float i = GetFloat();
16+
17+
// convert tempreture
18+
float j = (i * 9 / 5) + 32;
19+
20+
// display the result
21+
printf("This number in Farenheit is: %.1f\n", j);
22+
return 0;
23+
}
24+

0 commit comments

Comments
 (0)