CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program {
	 long double y;
	cin>>y;
	 long double sum=0,term=y;
	int n=2;
	while(term>0.0000001) {
		sum=sum+term;
		term=(term*y*y*(2*n-3)*(2*n-3))/((2*n-2)*(2*n-1));
		n++;
	}
	cout<<sum;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program{
	float y;
     float  x=0;
        int facn=1;
     if(y>0 && y<=1){
          
	     for(i=1;i++){
	    x=x+y-(y*y*y)/(facn*3)+((3*3)*(y*y*y*y*y))/facn*5;
     }
     cin>>y;
     cout<<x;}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program
{
	double y; cin>>y;
	
	double x = PI/4.0;
	while(abs((sin(x) - y)/cos(x))>=0.0001)
	{

		x = x - ((sin(x) - y)/cos(x));
	}
	cout << fixed; // uses fixed floating point representation
	cout.precision(3);
	cout<<x;
	

}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program{
	double x;
	cin >> x;
	double sum=0;
	double w=x/100000000;
	int i;
	for(i=0;i<100000000;i++){
		sum = sum + (w/(sqrt(1-pow(i*w,2)))) ;
	}
	cout << fixed;
	cout.precision(3);
	cout << sum << endl;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include <simplecpp>

//using newton-raphson method

main_program
{
	double y;
	cin>>y;
	double x = 1;					//initial guess
	while(abs(sin(x) - y) > 0.000000001)
	{
		x -= (sin(x) - y)/(cos(x));		// newton_raphson method  x(i+1) = x(i) - f(x)/f'(x)
							// here, f(x) = sin(x) - y
	}

	cout<<fixed;
	cout.precision(3);
	cout<<x;

}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
int main(){
	double x,y;
	cin >> y;
	x= 0.000;

	if (y==1) 
	{ 
		x = 1.571;
		goto end;
		
	}

	while (sin(x)<=y)
	{ 
		x = x+0.000001;

	}
end:
	cout<< fixed;
	cout.precision(3);

	cout << x;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program
{
	float k,xm,xl,xr;
	cin>>k;
	if(k==1)
		cout<<1.571<<endl;
	else if(k==-1)
		cout<<-1.571<<endl;
	else
	{
		xl=-PI/2,xr=PI/2;
		xm=(xl+xr)/2;
		repeat(1000)
		{
			xm=(xl+xr)/2;
			if(sin(xm)-k<0)
				xl=xm;
			else
				xr=xm;
		}
		xm=xm*1000;
		int a=xm/1;
		cout<<a/1000.0<<endl;
	}
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include <simplecpp>
main_program {
	float y;
	cin >>y;
	if (y>=0&&y<=1){
		float x=0.75, x1=0.74;
		while(abs(x-x1)>0.0001){
			x1=x;
			x= x- (sin(x)-y)/cos(x);
		}
		cout << fixed;
		cout.precision(3);
		cout << x;
	}
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program{
	double y,sum=0;
	cin>>y;
	double term=y;
	sum=y;
	for (int i=2; i<100; i++){
		term=(term*y*y*(-1))/((i)*(i+1));
		sum+=term;}
	cout<<fixed;
	cout.precision(3);
	cout << sum;

}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program{
	double y,x=1;
	cin>>y;
	while(abs(sin(x)-y)!=0){
		x=x-tan(x)+y/cos(x);
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x;}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program
{ double k;  double x=0.75;
	cin>>k;
	repeat(20)
	{ x= x-(sin(x)-k)/cos(x);
	}//using newton raphson method to calculate sin inverse k
  cout<<fixed; cout.precision(3);
  cout<<x;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include <simplecpp>

main_program{
	double y;
	cin >> y;
	double xn = PI / 4, xn1 = 0;
	//initializing values xn = pi/4 as it is in the middle of the function and can cover the range of 0 to pi/2 during the iterations
	while(abs(xn - xn1) >= 0.0001){
	//usage of more precise boundary condition so that rounding errors do not take place near 0 and pi/2 as derivative there is zero
		xn1 = xn;
		xn = xn - tan(xn) + (y / cos(xn));
		//Newton-Rhapson method
	}
	cout << fixed;
	cout.precision(3);
	cout << (xn) << endl;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program {
	double y;
	cin>>y;
	double xl=0,xr=PI/2, xm;
	bool xl_pos=sin(xl)-y>0;
	while (abs(sin(xl)-y)>0.0001) {
	xm=(xl+xr)/2;
	bool xm_pos=sin(xm)-y>0;
	if(xm_pos==xl_pos) xl=xm;
	else xr=xm;
	}
	cout<<fixed;
	cout.precision(3);
	cout<<xr;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program{
	double y,x=0;
	cin>>y;
	if(y<=1 && y>=0)    {for(int i=0;i<100;i++){
				x=x-((sin(x)-y)/cos(x));}
	cout<<fixed;
	cout.precision(3);
	cout<<x<<endl;}
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program{
	double y;
	double x = 0;
	cin>>y;
	//bisection method f(x) = sin(x) - y
	double x1 = 0;
	double x2 = PI/2;
	while(x2 - x1 > 0.0001){
		double x3 = (x1+x2)/2; //finding midpoint
		//switching the loop
		if (sin(x3) - y > 0){x2 = x3;}
		else if(sin(x3) == y){x1 = x2= x3;}
		else{x1 = x3;}
	}
	//final value to be outputted.
	x = (x1+x2)/2;
	cout<<fixed;
	cout.precision(3);
	cout<<x;

}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include <simplecpp>

//creating function fx:= y = sinx - n, where n is whose 1/root we need
double f(double x, double n){
	double y = sin(x) - n;
	return y;
}

main_program{
	double y; cin >> y;
	double epsilon = pow(10,-15);// permissible error
	double pi = 3.1415926,a = 0,b = pi/2, m = 0;
	//we are using bisection algorithm here, So:
	//a,b are end points of domain
	//m acts as the middle point

	while(epsilon < abs(f(a,y))){
		m = (a+b)/2;
		if(f(m,y) > 0){
			b = m;// b,m have same sign
			      // and m is closer to ans than b
		}
		else{
			a = m;// similarly for a
		}
	}
	double ans = (a+b)/2;

	// for 3 digit precision
	// Approximation
	int temp = ans*pow(10,3);
	if(ans*pow(10,3) >= temp + 0.5){
		temp = temp + 1;
	}
	ans = temp/pow(10,3);
	
	//precision
	cout << fixed;
	cout.precision(3);
	cout << ans << endl;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include <simplecpp>
main_program{
	double y;
	cin>>y;

	float x;
	x= 0;
	repeat(1000){
		x= x- (sin(x)-y)/cos(x);



	}
	cout<<fixed;
	cout.precision(3);
	cout<< x;



}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program{
	double y;
	cin >> y;
	double w,x=0;
	w = y/100000000;
	for(double k=0;k<100000000;k++){
		x+= w/sqrt(1-((k)*(k)*w*w));
	}
	cout << fixed;
	cout.precision(3);
	cout << x;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program{
//we will solve this by rienman integration
// we would divide 1 to y into  500000000 divisions for acuracy otherwise at 1 it will show 1.56... for 100000 iterations .
// due to this it will take time to compute value at 1.
	double y;
	cin>>y;
	long double x=0,w=y/500000000.0;
	 long  int i=0;
	repeat(500000000){
	x+=(1.0/(sqrt(1-i*i*w*w)))*w;
	i++;}
cout<<fixed;
cout.precision(3);
cout<<x;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program{
	float y;
	cin>>y;
	float a,b;
	a=0;
	b=PI/2;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program{
	double y;
	cin>>y;
	double x=y,a=y,i=1;
	repeat(100000000){
		a=a*pow(y,2)*(2*i-1)*(2*i-1)/((2*i+1)*2*i);
		x=x+a;
		i=i+1;
	}


	cout<<fixed;
	cout.precision(3);
	cout<<x<<endl;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program {
	float y,espi;
	cin>>y;
	espi = 0.000000001;
	float x=0;
	while ((sin(x)-y)>=espi) {
		x += ((sin(x)-y)/cos(x));
		y += espi;
	}
	cout<<x<<endl;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program
{
	double y;
	cin>>y;
	double x=0;
	double n=1;
	for (int i=0;i<=100000000;i++)
	{
		
		x=x+(pow(y,2*i+1)*n)/(2*i+1);
		n=n*(float((2*i+1))/((i+1)*2));
		
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>
main_program
{
	double y,xr=PI/2.0,xl=0,xm=(xl+xr)/2.0,delta=0.00001;
	cin>>y;
	bool xlpos = sin(xl)-y>0,xmpos = sin(xm)-y>0;
	while((xm-xl)>=delta)
	{
		xm=(xl+xr)/2;
		if(xmpos)
		{
			if(xlpos){xl=xm;}
			else{xr=xm;}
		}
		else{if(xlpos){xr=xm;}
			else{xl=xm;}
		
		}
		xm=(xl+xr)/2;
	}
	cout<<fixed;
	cout.precision(3);
	cout<<xm;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<simplecpp>

main_program
{
	// We use the Bisection method to solve the function
	// f(x) = sin(x) - y
	// We wish to find the root of this function to three decimal spaces
	// Since y is between 0 and 1
	// f(0) <= 0 and f(PI/2) >= 0.
	// Also only one root of the function will exist between 0 and Pi/2
	// So we let  x_l = 0, x_r = Pi/2 Initially
	
	// Taking input
	double y;
	cin >> y;
	double x_l, x_r, x_m;

	// Initializing x_l and x_r
	x_l = 0;
	x_r = M_PI / 2;

	// After n iterations x_r - x_l = PI/(2 ^ (n + 1))
	// And the root always lies between x_r and x_l
	// After 15 iterations x_r - x_l < 10^(-4)
	// So x_l will be withinn 10^(-4) of the root
	// Hence x_l will approximate to root upto three decimal points properly
	for (int i = 0; i < 15; i++)
	{
		x_m = (x_l + x_r) / 2;
		if (sin(x_m) - y > 0)
		{
			x_r = x_m;
		}
		else
		{
			x_l = x_m;
		}
	}

	// Printing the calculated root
	cout << fixed;
	cout.precision(3);
	cout << x_l << endl;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include<iostream>
using namespace std;
float pow(float x, int y){
for(int i=1;i<y;i++){
 x=x*x;}
return x;
}
int main(){
  float y;
  cin>>y;
  float x= y+ pow(y,3)/6 + 9*pow(y,5)/120 + 225*pow(y,7)/5040;
  cout<<fixed;
  cout.precision(3);
  cout<<x;
  }

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B
Problem: Given a real number y   [0,1], find the value of x, in radians, such that sin(x) = y, without using any trigonometric-inverse function. The value x should lie within the interval [0, pi(3.14) /2]. Write an iterative program that prints the value of x. Do NOT use a brute-force search at all.

Constraints

0 <= y <= 1

0 <= x <=  pi (3.14) /2

Student submission:
#include <simplecpp>
main_program{
	double y;
	cin>>y;
	double x;
	x = (arcsine(y))*(PI/180);
	cout<<fixed;
	cout.precision(3);
	cout<<x<<endl;
}

Grading criterion: E.g. Use of functions beyond what was instructed or any other code quality
Rating A: Modularity, Extra Functions Defined
Rating B: No extra things
Rating C: 0
Rating D: 0
Assigned grade: B