• News

• Industries

• Learning & Support

• Community

• Marketplace

# I need help with my C Program I am stuck

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.

But doesn’t that just make you question why you’re paying all that money to go in the first place?

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.

my_var =sqr(k/m)

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)

``````
// Convert a degree to a radian
#define degToRad(angleDeg) (angleDeg * M_PI / 180)

// Convert a radian to a degree

``````

So this is what I have but still don’t know where to go from here. LOL

I am still stuck at the COS part and the g/s squared. I assume that can be written as s*s?

What I don’t get is what does cos even have to do with this formula?

#include <stdio.h>
#include <math.h>
#define degToRad(angleDeg) (angleDeg * M_PI / 180)

void main()

{

``````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);
``````

}

I understand that degrees*PI/180 gives you radians

But what does that even have to do with this program? for cos to work with radians won’t you need a actual degree number? I dunno

hey I got through with it guys seems I was super really close lol.