Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int abc(int x);
- int main()
- {
- int x;
- printf("f(x) = x2 + 2x + 3 if x < 0 \nf(x) = 0 if x = 0\nf(x) = x - 2 if x > 0");
- printf("\nEnter number :");
- scanf("%d",&x);
- abc(x);
- return 0;
- }
- int abc(int x)
- {
- int y;
- if(x<0){
- printf("f(x) = x2 + 2x + 3\nf(%d) = %d",x,(x*x)+(x*2)+3);
- }
- else if(x==0){
- printf("f(x) = 0 \nf(%d) = %d",x,0);
- }
- else{
- printf("f(x) = x - 2 \nf(%d) = %d",x,x-2);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement