Advertisement
lnsee96

1-15

Aug 22nd, 2016
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "stdio.h"
  2. /*Use a function to print a Fahrenheit-Celsius conversion table using the formula C=(5/9)*(F-32) with a step of 20 between values of 0 t 300 of Fahrenheit temperatures*/
  3. #define STEP 20
  4.  
  5. int Convert(int f);
  6.  
  7. main()
  8. {
  9.     int i, sum=0;
  10.     int array[16];
  11.     for (i=0;i<16;++i)
  12.     {
  13.         if (i!=0)
  14.         {
  15.             sum=sum+STEP;
  16.         }
  17.         array[i]=sum;
  18.     }
  19.     for (i=0;i<16;++i)
  20.     {
  21.         printf("%d\t%d\n",array[i],Convert(array[i]));
  22.     }
  23. }
  24.  
  25. int Convert (int f)
  26. {
  27.     int c;
  28.     c=5*(f-32)/9;
  29.     return c;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement