x | y |
x<=5 | 5+3x-7 |
5<x<10 | 2x-1 |
x>=10 | 3-11 |
#include<stdio.h>
#include<math.h>
void main(){
double x,y;
scanf("%lf",&x);
if(x<=5) y=5*pow(x,2)+3*x-7;
if(x>5&&x<10) y=2*x-1;
if(x>=10) y=3*sqrt(x)-11;
printf("%f",y);
}
x | y |
x<=5 | 5+3x-7 |
5<x<10 | 2x-1 |
x>=10 | 3-11 |
#include<stdio.h>
#include<math.h>
void main(){
double x,y;
scanf("%lf",&x);
if(x<=5) y=5*pow(x,2)+3*x-7;
if(x>5&&x<10) y=2*x-1;
if(x>=10) y=3*sqrt(x)-11;
printf("%f",y);
}