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{
	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: 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 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: 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 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: 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 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: 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 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: 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,y;
cin >> y;
// sinx = x - x^3/3! ;
float delta = 0.001;
for(int i = 0; i<x;i++){
	

}


}

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: C
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: 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 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: 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;
	cin >> y;
	float x;
	x=(arcsine(y))*PI;
	x=x/180;
	cout << x;
	cout.precision(3);
}

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

float x;
x=arcsine(y);
float ans=(PI/180)*x;
      
     cout<<fixed;
     cout.precision(3);
     cout<<ans;
     





}

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 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: 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
{
	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: 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,xL=0,xR=PI/2,xM;
	cin>>y;
	while(xR-xL > 0.00000001){
		xM = (xR+xL)/2;
		if ((sin(xL)-y)*(sin(xM)-y)<0){
			xR = xM;
		}
		else {
			xL = xM;
		}
	}
	cout<<fixed;
	cout.precision(3);
	cout<<xR;
}

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 y;
	cin>>y;
	double e=0.0000001;
	double x=1.0;
	while(abs(sin(x)-y)>e){
		x=x-tan(x)+y/cos(x);
	}
	cout<<fixed;
	cout.precision(3);
	cout<<abs(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: 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,x=0.5;
       	cin>>y;
	double exp=(sin(x)-y),epsilon=1.0e-15; //Consider function sin(x)-y. Then our goal is jus to find zeroes of this equation for a given value of y

	//Using Newton-Raphson iterations to compute the root of the given equation
	while (abs(exp)>=epsilon){
		x=x-tan(x)+(y/cos(x));
		exp=(sin(x)-y);}
	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{
	float y;
	cin>>y;
	float xl,xm;
	xl=0;
	xm=PI/2;
	while ((xm-xl)>0.001){
		if(y<(sin((xl+xm)/2))){
			xm=(xl+xm)/2;
			
		}
		if (y>sin((xl+xm)/2)){
 			xl=(xl+xm)/2;
	
		}
	}
	
		float x=(xl+xm)/2;
		cout.precision(3);
		cout<<x;
		cout<<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 y;
	cin>>y;

	


	double x1=0.0;
	double x2=90.0;

	while (abs(sine((x1+x2)/2)-y)>=0.000000001)
	{

	if(sine((x1+x2)/2)>=y)
	{
		x1=x1;
		x2=(x1+x2)/2;
	}

	else
	{
		x1=(x1+x2)/2;
		x2=x2;
	}
	}

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

	cout<<((x1+x2)/2)*PI/180.0;
}

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 xl=0;
	double xr=PI/2;

	for(int i=0; i<1000; i++){
		double x= (xl+xr)/2.0;

		if((sin(x)-y)>=0){
			xr = x;
		}else{
			xl=x;
		}

	}

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

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;
        int i=0;
	while(x<=PI/2){  
		x=x+((pow(-1,i)*pow(y,2*i+1))/2*i+1);
		i=i+1;
	}
	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
{
    double y,x;
    cin>>y;
    x=0;
    //cout<<sin(90*PI/180);
    for(int i=0;i<=1800;i++)
    {
    double z=sin(x*PI/180);
    if(z==y) {break;}
    x=x+0.05;
    }
    cout<<fixed;
    cout.precision(3);
    cout<<(x*PI/180);
    cout<<sin(30*PI/180);
}

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,x=0.786;
	cin>>y;
	repeat(20){
	       x=x-(sin(x)-y)/(cos(x));
            }
	 
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{
	float y;
	cin>>y;
	float xL=0;
	float xR=PI/2;
	float xM=0;
	xM = (xL+xR)/2;
	float a;
	float b;
	float c;
	a = sin(xL)-y;
	b = sin(xR)-y;
	c = sin(xM)-y;
	if (c==0){
		cout<<xM;
		xM=(xL+xR)/2;
	}
	else if (a*c>0)
		xL = xM;
	else xR = xM;
	
}

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: C
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 x;
	cin >> x;
	float term = x;
	float sinx = x;
	//idea is to write taylor polynomial of sininversex;
	int i = 0;
	repeat(10000){
		term *= ((x*x)*(0.5+i))/((2*i+3)*(i+1));
		sinx += term;
		term *= (2*i+3);
		i++;
	}   // using two repeat staements to make finer precision
       repeat(10000){
       		term *= ((x*x)*(0.5+i))/((2*i+3)*(i+1));
 		sinx += term;
		term *= (2*i+3);
		i++;
	}
	repeat(10000){
	 	term*= ((x*x)*(0.5+i))/((2*i+3)*(i+1));\
	        sinx += term;
 		term *= 2*i +3;
		i++;
	}		
	cout << fixed;
    	cout.precision(3);	
	cout << sinx;
		
}

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;
	cin>>y;
	float xL=0;
	float xR=PI/2;
        
	repeat(100)
	{
        float xM = (xL+xR)/2;
        bool xM_is_positive  = ((sin(xM)-y) >0);	
        
	if(xM_is_positive)
	{
	xR = xM;
	}
	else
	{
	xL = xM;
	}
	}


	cout<<fixed;
	cout.precision(3);
	cout<<xR<<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 y; cin>>y;

	double l=0, u=PI/2;
	//running bisection method on f(x)=sinx-y over (0,1)
	
	bool pos_at_l=sin(l)-y>0;
	
	while(u-l>0.0001){
		bool pos_at_mid=sin((l+u)/2)-y>0;

		//if u+l/2 and l have same signs, we replace l by u+l/2 and vice versa


		if (pos_at_mid==pos_at_l) l=(l+u)/2;
		else u=(l+u)/2;
	}// iterations end when u and l come closr than 0.0001

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

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 a=0,b=1.571;
	float c;
	cin>>c;
	if(c!=1)
	{
	float m=0.5;
	while(m-c>0.0009999999999999999||c-m>0.000999999999999999)
	{
		if(m>c)
		{b=m;}
		else
		{a=m;}
		m=(sin(a)+sin(b))/2;
	}
	cout << fixed; // uses fixed floating point representation
cout.precision(3); // print three digits after the decimal point
	cout<<m;
	}
	else
		cout<<1.571;
}

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 x ;
	cin >> x ;

	float y =0 ;
	int i = 3 ;
	float next_term=x ;
	while(next_term>=0.001 or next_term<=-0.001){
		y = y + next_term;
		next_term = next_term*(x*x)/i ;
		i+=2 ;
		cout << next_term << endl ;

	}
	cout << y << 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