Advertisement
Guest User

Untitled

a guest
Oct 15th, 2013
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.71 KB | None | 0 0
  1. // Florian Grasshoff - Aufgabenzettel 3 - Nr.2
  2.  
  3. #include <stdio.h>
  4. #include <stdlib.h>
  5.  
  6. float celsius2kelvin(int x)
  7. {
  8.     float y;
  9.     y=x + 273.15; //Hier bitte Berechnung einfugen
  10.     return y;
  11. }
  12.  
  13. float celsius2fahrenheit(int x)
  14. {
  15.     float y;
  16.     y=x*1.8+32; //Hier bitte Berechnung einfugen
  17.     return y;
  18. }
  19.  
  20. int main()
  21. {
  22.     float temp_celsius,temp_kelvin,temp_fahrenheit;
  23.     int i;
  24.     printf("Celsius\t\tKelvin\t\tFahrenheit\n");
  25.     for(i=1;i<=100;i++){
  26.     temp_celsius=i;
  27.     temp_kelvin=celsius2kelvin(i);
  28.     temp_fahrenheit=celsius2fahrenheit(i);
  29.     //Ausgabe mit 3 Nachkommastellen
  30.     printf("%9.3f\t%9.3f\t%9.3f\n",temp_celsius,temp_kelvin,temp_fahrenheit);
  31.     }
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement