daniel_lawson9999

Daniel Lawson Celius to Fahrenheit

Sep 12th, 2017
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.43 KB | None | 0 0
  1. # include <cs50.h>
  2. #include <stdio.h>
  3.  
  4. int main(void){
  5.     printf("C: ");
  6.     float celcius = get_float();
  7.     printf("\nF: %.1f", (((celcius * 9.0) / 5.0) + 32));
  8.     return 0;
  9.  
  10. }
  11. //formula for conversion from celcius to fahrenheit F = ((C * 9) / 5) + 32
  12. /*
  13.     alternative solution:
  14.     scanf("C: %f\n",&celcius);
  15.     printf("F: %.1f\n",(((celcius*9)/5)+32));
  16.    
  17.     sample output:
  18.     C: 30
  19.  
  20.     F: 86.0
  21.     */
Advertisement
Add Comment
Please, Sign In to add comment