Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main() {
- float x;
- float resultado;
- scanf("%g", &x);
- if (x < 0) {
- resultado = x + 2;
- }
- else if (x == 0 || x < 2) {
- resultado = (x * x * x) - (5 * x) + 2;
- } else if (x == 2) {
- resultado = (x * x * x) - (5 * x) + 2;
- }
- else if (x > 2) {
- resultado = x + 5;
- }
- printf("%g \n", resultado);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement