Загрузка...

Need to write code in pure C

Thread in C/C++ created by crazySoldier Dec 9, 2022. 199 views

  1. crazySoldier
    crazySoldier Topic starter Dec 9, 2022 Banned 1907 Oct 6, 2016
    может кто помочь?

    [IMG]
     
  2. unnamed001
    unnamed001 Dec 9, 2022 5996 Sep 2, 2020
    че по оплате?
     
    1. View previous comments (1)
    2. vtlstolyarov
      crazySoldier, для тригонометрических функций подключи
      #include <math.h>
      , возведение в степень там же
    3. crazySoldier Topic starter
      vtlstolyarov,
      C

      #include <stdio.h>
      #include <math.h>

      int main()
      {
      double a,y,z,x,d,e;
      x=1.426;
      y=-1.22;
      z=3.5;
      d=2*cos(x-M_PI/6)/0.5*(sin(y)*sin(y));
      e=pow(z,2)/3-pow(z,2)/5;
      printf("result #1 \n");
      printf("%d \n", d);
      printf("result #2 \n");
      printf("%e", e);

      return 0;
      }
      код уже есть, но в итог выводит разные результаты(
    4. Replacer
      crazySoldier, в плане разные? Странно, не должно так быть
      C
      #include <stdio.h>
      #include <math.h>

      int main(void) {
      double x = 1.426;
      double y = -1.22;
      double z = 3.5;

      double t_res = ((2 * cos(x - M_PI / 6)) / (0.5 + sin(y) * sin(y)));
      double e_res = (((pow(z, 2))) / (3 + (pow(z, 2) / 5)));

      printf("First equation result: %f\nSecond equation result: %f\n", t_res, e_res);

      return 0;
      }
      Code
      First equation result: 0.896916
      Second equation result: 2.247706
    5. View the next comments (1)
Top
Loading...