Guys I am stuck, my lecturer does not help because he said at University level the teachers aren’t responsible for actually teaching or helping anyone they are only there to lecture and its up to us to figure out everything on our own.
This is what I have so far but sadly its far from complete. I am stuck at the part where they say the parameter of cos is degrees and must be converted to radians for the C language cos () function. What do they mean by this and how am I supposed to know how to do it?
basically I don’t know how to implement the formula because if I type it as seen in the paper it will give an error.
If you are student of some technical school then shame on you. If you are part of some humanistic studies then you should not slept at math classes few years back.
add line:
my_var =sqr(k/m)
then your formula is:
v = A * my_var * cos (my_var *t)
and check if m != 0 else you can divide by zero and it will be end of our world!
ps.
Your severe lack of logic (as for uni student) is disturbing.
I went to an ivy league school and they said the same thing all the time… Really annoying lol. especially when you’re paying out the wazoo for classes.
First, PI is already defined in math.h, its under M_PI (it should be in most compilers)
It’s really easy to convert degrees to radians, for example for degs to rads is ‘degpi/180’ and rads to degs is 'rad180/pi’
// Convert a degree to a radian
#define degToRad(angleDeg) (angleDeg * M_PI / 180)
// Convert a radian to a degree
#define radToDeg(angleRad) (angleRad * 180 / M_PI)
int t, m, k, a;
double v, temp, cos;
printf("Enter Time in seconds");
scanf("%d", &t);
printf(" Enter Mass in grams");
scanf("%d", &m);
printf("Enter constant in g/s");
scanf("%d", &k);
printf("Enter distance in cm");
scanf("%d", &a);
temp = sqrt(k / m);
v = a*temp*cos*(temp*t);
printf("velocity is" "%5.0f", &v);