[ create a new paste ] login | about

Link: http://codepad.org/kJYbVAYX    [ raw code | output | fork ]

C++, pasted on Nov 14:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include "stdio.h"
#include "math.h"
int main()
{
float x;
float y;
printf("input x:");
scanf("%f",&x);
y=(0<=x&&x<20)?5*x+11:
(
    (20<=x&&x<40)?sin(x)+cos(x):
    (
        (40<=x&&x<60)?exp(x)-1:
        (
            (60<=x&&x<80)?log(x+1):0
        )
    )
);
printf("%f",y);
}


Output:
1
input x:11.000000


Create a new paste based on this one


Comments: