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>
int main(){
long double x; cin>>x;
long long int n=10000;
long double w=(x)/n;
long double sum=0;
int i=0;
repeat(n){
	sum=sum+(1/sqrt(1-(i*i*w*w)))*w;
	i++;
}
cout<<fixed;
cout.precision(3);
cout<<sum<<endl;
}

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: A
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;
cin>>k;

double xM,xL=0,xR=PI/2;
while(abs(xR-xL)>0.0001){
xM=(xL+xR)/2;
if (sin(xM)>=k){
xR=xM;}
else {xL=xM;}
}

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

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: A
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{
	//finding inverse by integrating 1/sqrt(1-x*x) from 0 to x
	float y;cin>>y;
	double x=0;
	double w=1.0E-8;//width of strips used for reimann integration
	for (double t=0;t<y;t+=w){
		x+= w/sqrt(1-t*t);
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x;
}

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
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 xR = PI/2, xL = 0;
	bool xL_positive = sin(xL) > y;
	bool xR_positive = sin(xR) > y;

	while(xR - xL > 0.0001){
		double xM = (xL + xR)/2;
		bool xM_positive = sin(xM) > y;
		
		if(xL_positive == xM_positive) xL = xM;
		else xR = xM;

	}

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

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: A
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,y;
	cin>>y;
	double epsilon=0.0001;
	double L=0,R=PI/2;
	while((R-L)>=epsilon) {
		if((sin(x)-y)>=0) {
				R=x;
				x= (x+L)/2;

				}
		else {
		L=x;
		x=(x+R)/2;
		}
		}
	cout<<fixed;
	cout.precision(3);
	cout<<x;
	}

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: A
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,x=0;
	cin>>y;
	repeat(100){
		x = x+(y-sin(x))/(cos(x));
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x;
}

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: A
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,x1,y1,x2,y2,epislon;
	cin>>y;
	x1=0;
	x2=PI/2;
	epislon=0.0001;
	while(abs(sin((x1+x2)/2)-y)>epislon){
		bool middle=(sin((x1+x2)/2)-y)>0;
		if(middle==false){x1=(x1+x2)/2;}
		else{x2=(x1+x2)/2;}}
		cout<<(x1+x2)/2<<endl;}

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
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=0,y,c;
	double k=1;
	cin>> y;
	c=y;
	repeat(1000000000){
		x=x+y;
		
		y=y*c*c*(2*k-1)*(2*k-1)/(2*k*(2*k+1));
		k=k+1;
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x<<endl;
}

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
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 sum=0,t=y;
	int i=0;
	repeat(100000000) {
		sum=sum+t;
		t=t*y*y*(2*i+1)*(2*i+1)/(2*i+3)/(2*i+2);
		i++;

	};
	

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

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
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 x1=0,x2=PI,x3=(x1+x2)/2;
	double k=sin(x3)-y;
	while(abs(k)>1.0e-1){
		if ((sin(x3)-y)*(sin(x2)-y)<0){
			x1=x3;
			x3=(x1+x2)/2;
		}
		else{
			x2=x3;
			x3=(x1+x2)/2;
		}
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x3;
}

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
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{
	int a=1;
	int i=1;
	float b;
	float x;
	float ans;
	cin>>ans;
	b=x;
		a=a*(i+1)*(i+2);
		b=b*pow(x,2)*(-1);
		ans=x+b/a;

i=i+1;
cout<<x<<endl;

}

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
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=0.5;
	double y;
	cin >> y;

	repeat(1000){
		x = (x*cos(x) - sin(x) + y)/cos(x);
	}
	cout<<fixed;
	cout.precision(3);
	cout << x;
}

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
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 n =2000000,i=0,y = 0;
	double w,x;
	cin >> x;
	int b;
	b = n*x;
        
	repeat (b) {
                
		w = i/n;
		y = y +(1/(sqrt(1-w*w)))*(1/n);
		i++;
		    
		     }
	cout<<fixed;
	cout.precision(3);
	cout<<y;

}

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: A
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>
float value(float n, float y) {
	float result = 0;
	for(int i = (1/n); i < y; i+=(1/n)) {
		result += ( 1/(sqrt(1 - ((i-(1/n))*(i-(1/n)))))*(1/n));
	}
	return result;
}
main_program {
	float y;
	cin >> y;
	float n = 5000;
	float res = 0;
	while(y - sin(res) > 0.001) {
		n+=5000;
		res = value(n, y);
	}
       cout << fixed;
	cout.precision(3);
 	cout << res;	
}

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
Rating D: 0
Assigned grade: A
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=0,y;
	cin>>y;
	repeat(100){
		x=x-((sin(x)-y)/(cos(x)));
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x;
}

Grading criterion: Quality of Variable Names
Rating A: Good variable names
Rating B: Ok Variable Name
Rating C: Poor Variable Names
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 y=0;
	while(sin(y)<x && y<=PI/2){
		y+=0.0001;
	}
	cout << fixed;
	cout.precision(3);
	cout << y;
}

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
Rating C: 0
Rating D: 0
Assigned grade: A
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=PI/4;
	double y;
	cin>>y;
	while(((sin(x)-y)>0.00000001)||((sin(x)-y)<-0.00000001)){
		x=x-(sin(x)-y)/cos(x);
	}
	cout << fixed;
	cout.precision(3);
	cout<<x;
}

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
Rating C: 0
Rating D: 0
Assigned grade: A
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 term=1,sum=0,i=2;
	term = term*y;
	sum = sum+term;
	repeat(20){
		term = (term*(-1)*pow(y,2))/i*(i+2);
		sum = sum + term;
                }
         cout<< fixed;
         cout.precision(3);
         cout<< sum << endl;
	 }

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
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 x =1;
	if((y>=0&&y<=1)){
	while(abs(sin(x)-y)>0.00000000000001)
	{
		x = x - (sin(x)-y)/cos(x);
	}
	if(x>=0&&x<=PI/2)
	{
        cout<<fixed;
	cout.precision(3);
	cout<<x;
	}
}
}

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
Rating C: 0
Rating D: 0
Assigned grade: A
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 x;
	float term=x,sum=0;
	int k=1;
	if(0<=y<=1,0<=x<=1.571){
		repeat(1000){
		        sum=sum+(term);
		        term=(term*(-1)*pow(x,2))/(4*k*k+2*k);
		        k=k+1;
		}
		y=sum;
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x;
}

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
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 b=PI/2;
	double a=0;
	double y;
	cin>>y;
	while(abs(sin((a+b)/2)-y)>0.0001&&y<1&&y>0){
		if(sin((a+b)/2)>y)
			b=(a+b)/2;
			
		 else if(sin((a+b)/2)<y)
			a=(a+b)/2;
		else if(sin((a+b)/2)==y)
			 break;
	}
	double c=(a+b)/2;
	if(y==0)
	c=0;
	if(y==1)
		c=PI/2;
	cout<<fixed;
	cout.precision(3);
	cout<<c;
}

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
Rating C: 0
Rating D: 0
Assigned grade: A
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,y;
cin >> y;
// sinx = x - x^3/3! ;
float delta = 0.001;
for(int i = 0; i<x;i++){
	

}


}

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
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;
	double l=0;
	double u=PI/2;

	for(int i=0;i<=1000;i++){

		if((sin((u+l)/2)-y)>=0){u=(u+l)/2;}
		else{l=(u+l)/2;}
	}
	x=(u+l)/2;
	cout << fixed; // uses fixed floating point representation
	cout.precision(3); // print three digits after the decimal point
	cout<<x;
}

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
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 x=1;
	repeat(1000){
	x=(x*cos(x)-sin(x)+y)/cos(x);
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x;
}

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
Rating C: 0
Rating D: 0
Assigned grade: A
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 x;
	x=(arcsine(y))*PI;
	x=x/180;
	cout << x;
	cout.precision(3);
}

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
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{
	int x;
	int y;

	cin >> 0 <= y <= 1;
	cin >> 0 <= x <= PI/2;









	cout << fixed;	// uses fixed floating point representation
	cout.precision(3); //  print three digits after the decimal point

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
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;//y is between 0 and 1
	cin>>y;
	double x1=0,x2=PI/2;
	//The function is sin x-y.I am using bijection method to compute roots.
	//Let x represent mean of x1 and x2 and b represent the boolean variable that shows the sign of sin x-y
	//Let us use bijection till sin x and y are epsilon close.Here we take epsilon 1e-20 which is more than enough for 3 decimal
	// accuracy
	float epsilon=pow(10,-20);
	double x=(x1+x2)/2;
	bool b=(sin(x)-y)>0;
	while ((sin(x)-y)>epsilon || (sin (x)-y)<-1*epsilon)  //To show that when absolute value of sin x-y is more than epsilon
	{
		if (b==true)
		{
			x2=x;
		}
		else x1=x;
		x=(x1+x2)/2;
		b=(sin(x)-y)>0;
	}
	cout<< fixed;
	cout.precision(3);
	cout<<x<<endl;
}

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
Rating C: 0
Rating D: 0
Assigned grade: A
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 x;
x=arcsine(y);
float ans=(PI/180)*x;
      
     cout<<fixed;
     cout.precision(3);
     cout<<ans;
     





}

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
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;
      while(y-sin(x)>0.00000001) {x=(-sin(x)+x*cos(x)+y)/cos(x);}
      cout<<fixed;
	cout.precision(3);
        cout<<x; }

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
Rating C: 0
Rating D: 0
Assigned grade: A
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 x,y;
	cin>>y;
	x=1;
	while(abs(sin(x)-y)>0.000000000000001)
	{
		x=x-(sin(x)-y)/cos(x);
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x<<endl;
}

Grading criterion: Termination of loops
Rating A: Appropriately terminating any loop used
Rating B: Loop goes in an infinite loop or wrong termination condition
Rating C: 0
Rating D: 0
Assigned grade: A