Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- double calc(double x);
- int main(void)
- {
- /*Declaration of variables*/
- double input,
- output;
- /*Print user interface*/
- printf("Enter a number x: ");
- /*Scan for user input*/
- scanf("%lf", input);
- /*Call to calculating function*/
- calc(input);
- /*Print the calculated value*/
- printf("f(x) = %f\n", input );
- /*Return value to operating system*/
- return 0;
- }
- double calc(double x)
- {
- /*Function*/
- if ( ( ( x * x ) - ( 5 * x ) + 6 ) != 0 && ( ( 3 * x ) + 6 ) > 0 )
- {
- return ( ( 1 + ( ( x * x ) / ( sqrt( ( 3 * x ) + 6 ) ) ) ) / ( ( x * x) - ( 5 * x ) + ( 6 ) ) );
- }
- else
- {
- printf("f(x) is not defined\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement