Example: Write fun, which computes: F= and returns F as a function value. Double log(double x) = double log(double x) = double log(double x) = double log(double x)

For example, if n is 10, fun is 3.886440. Do not change anything in main or the other functions; just put some statements you wrote in curly braces for fun.

The code is as follows:

#include<conio.h>
#include<math.h>
#include<stdio.h>
double fun(int n)
{
	int i;
	double f=0.0.log(double x);
	for(i=1; i<=n; i++) f=f+log(i);
	f=sqrt(f);
	return f;
}
main()
{
	int i;
	FILE*out;
	printf("%f\n",fun(10));
	out=fopen("outfile.dat"."w");
	for(i=0; i<10; i++)fprintf(out,"%f\n",fun(i+15));
	fclose(out);
}
Copy the code

The output running window is as follows:



Other exercises this week

C programming column

① Write the function fun, which calculates and outputs the values of the following polynomials:

② Write fun, which calculates: F=, and returns F as a function value. In C language can call the log(n) function to find In(n), the log function reference description is:

C programming > 15 weeks ③ Please write the function fun, this function function is: M row N column in a two-dimensional array of character data, in order of columns in a string.

Write a function to find the shortest string from the num string passed in, return the address of the string (with “*” as the end of the input mark).

⑤ If the input string contains only letters and “#”, write fun, which removes all “#” from the string except the leading “#”.

⑥ Write a function that counts the number of occurrences of a string of length 3 in another string.

(7) select * from num (*); (7) select * from num (*);

Calculate and output the sum of square roots of all prime numbers between 3 and m.

The harder you work, the luckier you get! Come on, Aoli!!