Skip to content

Commit

Permalink
added temperature.c
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinbui904 committed Jan 26, 2022
1 parent 129077d commit 1437e0d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions assignment7-starter/collaboration.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I did not consult with anyone else on this assignment, all code found in this folder, with the exception of test_m.py, is written by Thien K. M. Bui
Binary file added assignment7-starter/temperature
Binary file not shown.
20 changes: 20 additions & 0 deletions assignment7-starter/temperature.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*temperature.c
Written by Thien K. M. Bui
Last modified 01-25-22
*/

#include <stdio.h>

int main() {
float input;
printf("What is the temperature in degrees Fahrenheit? ");
scanf("%f", &input);

if (input <= -459.67){
printf("Invalid temperature!\n");
}else{
float temp_celsius = (input - 32) * 5/9;
printf("%f degrees Fahrenheit is %f Celsius\n", input, temp_celsius);
}
return 0;
}

0 comments on commit 1437e0d

Please sign in to comment.