Search This Blog

Friday, October 7, 2011

Write A function defined as (x)=-2x+3 for x=3–C programs

   1:  #include<stdio.h>
   2:  #include<conio.h>
   3:  void main()
   4:  {
   5:  float x,fx;
   6:  printf("Enter the value of x:\n");
   7:  scanf("%f",&x);
   8:  if(x<=3.0)
   9:  fx=-2*x+3;
  10:  if(x>=3.0)
  11:  fx=2*x-3;
  12:  printf("X= %f\n f(x)= %f\n",x,fx);
  13:  getch();
  14:  }

No comments:

Post a Comment