Write a program using an F function to display the table of values of the function defined by \(f(x)=\sin{x}+\ln{x}-\sqrt{x}\) where x is an integer between 1 and 10.


Difficulty level
Video recording
This exercise is mostly suitable for students
#include <stdio.h>
#include <conio.h>

double F(int X)
{
	return sin(X) + log(X) - sqrt(X);
}

void main()
{
	int i;

	printf("\tX\tF(X)\n");
	for (i = 1; i <= 10; i++)
		printf("\t%d\t%lf\n",i, F(i));

	getch();
}

 

Back to the list of exercises
Looking for a more challenging exercise, try this one !!
Target sum in a BST