Answer to Question #233013 in C for shayan

Question #233013

Program the following. Implement the following equation 3x4 sin(180x) + 4x3 cos(90x) + x2 sin(tan(45)) + 7x + 9cos(90x2 ) where x may be user defined value.


1
Expert's answer
2021-09-03T15:18:33-0400
#include <stdio.h>
#include <math.h>

#ifndef M_PI
#define M_PI (3.14159265358979323846)
#endif

#define X (1)

int main() {
  // 3x4 sin(180x) 
  float res = 3.f * X * 4.f * sin(M_PI * X);
  // + 4x3 cos(90x) 
  res += 3.f * X * 4.f * cos(X * M_PI / 2.f);
  // + x2 sin(tan(45)) 
  res += X * 2.f * sin(tan(M_PI / 4.f));
  // + 7x 
  res += 7.f * X;
  // + 9cos(90x2 )
  res += 9.f * cos(X * 2.f * M_PI / 2.f);
  printf("Result: %f\n", res);
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS