Here's the question:
====================================
A Windsor company that makes household thermometers has just received a contract for a large shipment to the US. Their current line of thermometers has markings in Celsius but the U.S shipment needs to be in Fahrenheit.
You have been hired to write a program to calculate the Fahrenheit values so the labelling department can print new labels. The current product line has many different thermometers so your program must be flexible. The operator will enter the start and stop temperature as well as a the accuracy of the required label (hint: use this as your table step size).
The formula for conversion is: fahren. = 9/5 cels. +32
You should ask the user for a start and stop temperature and step size.
The output should look like the sample runs below.
Run 1
% ./a.out
Enter Start temperature (in degrees C) -40
Enter Stop temperature (in edges C) 40
Enter temperature accuracy (in edges C) .5
The conversion table is:
Celsius = -40.000000 Fahrenheit = -40.000000
Celsius = -39.500000 Fahrenheit = -39.099998
Celsius = -39.000000 Fahrenheit = -38.200001
Celsius = -38.500000 Fahrenheit = -37.299999
Celsius = -38.000000 Fahrenheit = -36.400002
Celsius = -37.500000 Fahrenheit = -35.500000
Celsius = -37.000000 Fahrenheit = -34.599998
Celsius = -36.500000 Fahrenheit = -33.700001
Celsius = -36.000000 Fahrenheit = -32.799999
Celsius = -35.500000 Fahrenheit = -31.900000
Celsius = -35.000000 Fahrenheit = -31.000000
Celsius = -34.500000 Fahrenheit = -30.100000
Celsius = -34.000000 Fahrenheit = -29.200001
Celsius = -33.500000 Fahrenheit = -28.299999
.
. (Some rows are deleted to fit the page. Yours should have all the values)
.
Celsius = 35.500000 Fahrenheit = 95.900002
Celsius = 36.000000 Fahrenheit = 96.800003
Celsius = 36.500000 Fahrenheit = 97.699997
Celsius = 37.000000 Fahrenheit = 98.599998
Celsius = 37.500000 Fahrenheit = 99.500000
Celsius = 38.000000 Fahrenheit = 100.400002
Celsius = 38.500000 Fahrenheit = 101.300003
Celsius = 39.000000 Fahrenheit = 102.199997
Celsius = 39.500000 Fahrenheit = 103.099998
Celsius = 40.000000 Fahrenheit = 104.000000
%
Run 2
Enter Start temperature (in degrees C) 5
Enter Stop temperature (in edges C) 9
Enter temperature accuracy (in degrees C) 1.5
The conversion table is:
Celsius = 5.000000 Fahrenheit = 41.000000
Celsius = 6.500000 Fahrenheit = 43.700001
Celsius = 8.000000 Fahrenheit = 46.400002
(Note: in this run, Celsius did not stop exactly at 9. This is because the next step after 8.0 is 9.5 which is past 9)
=================================
and here's my program:
#include <stdio.h>
int main()
{
int starttemp, stoptemp, numaccurate, calculate
printf("Enter Start temperature (in degrees) C:\n");
scanf("%d",&starttemp);
printf("Enter Stop temperature (in edges C):\n ");
scanf("%d",&stoptemp);
printf("Enter temperature accuracy (in edges C):\n");
scanf("%d",&numaccurate);
printf("The conversion Table is:\n");
for (starttemp=starttemp;stoptemp=stoptemp;numaccurate++);
{
printf("Celsius = %d\n",starttemp);
calculate = 9/5(starttemp) + 32
printf("Farhenheit = %d\n",calculate);
}
return 0;
}
your help is highly appreciated. thanks alot
|