Advertisement
mailnesia

konwerter

Apr 27th, 2015
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.68 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. void c2f(float c){
  5.  
  6. float f;
  7. f=c*(9.0/5.0)+32.0;
  8. printf("%f stopni Celsjusza to %f stopni Fehrenheita\n",c,f);
  9.  
  10. }
  11. void f2c(float f){
  12.  
  13. float c;
  14. c=(f-32.0)*(5.0/9.0);
  15. printf("%f stopni Fehrenheita to %f stopni Celsjusza\n",f,c);
  16.  
  17. }
  18. void wybor(int i){
  19. float x;
  20. printf("Podaj temperature :\n");
  21. scanf("%f", &x);
  22. if (i==0){
  23. c2f(x);
  24. }
  25. else{
  26. f2c(x);
  27. }
  28. }
  29. main(){
  30. printf("*********************** Konwerter temperatur ***********************\n");
  31. int i;
  32.  
  33. printf("Wpisz 0 zeby zamienic stopnie Celsjusza na stopnie Fehrenheita, wpisz 1 zeby zamienic stopnie Fehrenheita na stopnie Celsjusza:\n");
  34.  
  35.  
  36. scanf("%d", &i);
  37. wybor(i);
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement