# Thread: having problems with starting off code, should be pretty simple

1. ## having problems with starting off code, should be pretty simple

i'm completly clueless, and i need to have this done by wednesday next week (ya it's an assignement) i want to learn how to do this, because it surely wont be the last lab this semester,

A program is needed to create a linear model using the least-squares technique presented in class for the following temperature measurements obtained by the weather balloon in the stratosphere:
Altitude Temperature
(km) (oC)
20 -50
30 -40
40 -20
50 -2
Over this region of the atmosphere, these data are nearly linear, and thus we can use a linear model to estimate the temperature at altitudes other than ones for which we have specific data. Use two one-dimensional arrays to store the data shown above (hard-coded). Your program must compute the linear model from these data points, print the model to the screen with the beginning and ending altitudes to indicate the region over which the model is valid. In a loop, your program must then prompt the user for an altitude and compute and print to the screen the temperature at the desired altitude. Your program must validate the users entry with respect to the range of validity of the model. Looping and your program ends when the user enters a negative value for the altitude.

After what i can see, i need to calculate the best ajusted line for the information given
i have a formula that i can put in the program,

after wards, the user can input an information (altitude) and the program will give him the temperature

WHERE DO I START AND explain arrays to me please 2. simple array
Code:
```#include <stdio.h>

int main() {
int myFirstArray; // static array is basically a 'box' containing
// variables of a type with certain size, array
// index starts from 0 to SIZE - 1 (in this case 9)

myFirstArray = 10; // this is one way of assigning
// a value to an array

myFirstArray = 10 * 10; // you can also do computation of element

scanf("%d", &myFirstArray); // you can prompt input from
// the user, this is saying :
// get the input from the stdin (user) and
// assign it to the element number 1

printf("%d\n", myFirstArray); // to print the value of certain element

return 0;
}``` Popular pages Recent additions 