Function value of the function f(x)=x^3+x^2/2+2/x^2
Problem Statement
Write a c program to
first scan a number say x
and then calculate the value of following number
f(x)=x3+x2/2+2/x2
#include<stdio.h>
#include<math.h>
int main()
{
int x;
float res;
scanf("%d", &x);
res= pow(x, 3) + (x*x)/2.0 + (2.0)/(x*x);
printf("Result=%0.2f\n", res);
return 0;
}
No comments:
Post a Comment