Build a c program that stores data in 2 arrays One array wil
Build a c++ program that stores data in 2 arrays. One array will be for Fahr temperatures and one array will be for Celsius temperatures. The first array will store 0,20,40,60,.......300 as fahr Temp. The second array will store the corresponding Celsius Tep( 0, -17.8, 20, -6.7). Use a loop to fill the 2 arrays, then use a second loop to print the 2 Arrays.
Solution
#include <iostream>
using namespace std;
int main ()
{
float farh[16],celsius[16];
int i=0;
int k=0;
for(i=0;i<=300;i=i+20)
{
farh[k] = i;
celsius[k] = (farh[k]-32)*(5.0/9.0);
k++;
}
cout << \"Farenhite\\tCelsius\" << endl;
for(i=0;i<k;i++)
{
cout << farh[i] << \"\\t\" << celsius[i] << endl;
}
return 0;
}
OUTPUT:
Farenhite Celsius
0 -17.7778
20 -6.66667
40 4.44444
60 15.5556
80 26.6667
100 37.7778
120 48.8889
140 60
160 71.1111
180 82.2222
200 93.3333
220 104.444
240 115.556
260 126.667
280 137.778
300 148.889
