y=f(x) i Xe[-2;2] so cekor 0.2

    0

    0

    This code prints the following:

    -2 -0.2 0.

    #include <iostream>
    #include <math.h>
    
    #include <iostream>
    #include <math.h>
    using namespace std;
    
    int main()
    {
      float  x, y;
      for (x = -2; x <= 2; x=x + 0.2)
      {
        if (x < -1)
        {
          y = log(-x);
          cout << y << "\n";
        }
        if ((x <= 1) && (x >= 1))
        {
          y = (x * x) - 1;
          cout << y << "\n";
        }
        if (x > 1)
        {
          y = (x * x * x) - 1;
          cout << y << "\n";
        }
      }
      return 0;
    }
    
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.