Welcome Guest.


Enter the values ​​of X and H and output the value of F according to the formula. Simple and clear written in C language  Thank you.

Asked by: Jeffrey Thompson 220 views IT August 20, 2018

公式   F=a*x+b+c(H)其中,X、H为变量,F为输出值。a/b/c均为常数。a=0.46,b=29,c在不同区间取不同数值c的取值     当  H≤16         c=-7     当  16<H≤22     c=-6     当  22<H≤29     c=-5     当  29<H≤32     c=-2     当  32<H≤40     c=5     当  40<H≤48     c=19     当  H>48         c=25         

2 Answers

  1. +7Votes  

    #include <stdio.h>
    #include <math.h>
    int main ( )
    double x,y;
    printf("input x:");
    if (x<1) y = 2*x+3;
    else if (x>=10) y= sqrt( 3*x-4);
    else y=2*x*x-1;
    return 0;

    Brian Allen- August 20, 2018 |

  2. +3Votes  


       int H,c,b=29;
       float a=0.46,x;
       if (H<=16) c=-7;
       else if(H<=22) c=-6;
       else if(H<=29) c=-5;
       else if(H<=32) c=-2;
       else if(H<=40) c=5;
       else if(H<=48) c=19;

    Carl Harrison- August 20, 2018 |