Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- #include<stdlib.h>
- int main (){
- float x,y1,y2,y3,y4;
- printf("Por favor,digite um valor qualquer:");
- scanf("%f", &x);
- if (x<=1){
- y1=1;
- printf("Funcao de x: %.1f", y1);}
- else
- if (1<x && x<=2) {
- y2=2;
- printf("Funcao de x: %.1f", y2);}
- else
- if (2<x && x<=3) {
- y3=x*x;
- printf("Funcao de x: %.1f",y3); }
- else {
- y4=x*x*x;
- printf("Funcao de x: %.1f",y4); }
- printf("\n\n");
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment