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(){
	double y;
	cin>>y;
	double xL,xM,xR;
	xL=0;
	xR=1.571;
	bool xL_is_positive,xM_is_positive;
	xL_is_positive=(sin(xL)-y>0);
	while(xR-xL>0.0001){
		xM=(xL+xR)/2;
		xM_is_positive=(sin(xM)-y>0);
		if (xM_is_positive==xL_is_positive) {
			xL=xM;
		}
		else xR=xM;
	}
	cout<<fixed;
	cout.precision(3);
	cout<<xM<<endl;
}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 a=y;
	double b;
	double d=10;
	while(d>0.0001){
		b=a-(sin(a)-y)/cos(a);
		d=abs(b-a);
		a=b;
	}
	cout<<fixed;
	cout.precision(3);
	cout<<b;
}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 y;
	cin>>y;
	double sum;
	float num=0.5,rfac=1,r=0;
	repeat(20){
		for(int i=1;i<r;i++){
			num*=abs((-0.5-i));
		}
		for(int j=r;j>0;j--){
			rfac*=j;
		}
		sum+=(pow(y,2*r+1))*(num/rfac)/(2*r+1);
		r++;
	}
	cout<<fixed;
	cout.precision(3);
	cout<<sum<<endl;
}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 xL=0,xR=PI/2,x,y;
	cin >> y;
	while(y-sin(xL)>1.0E-20 && sin(xR)-y>1.0E-20)
	{
		if(sin((xL+xR)/2)-y>0)
			xR=(xL+xR)/2;
		else
			xL=(xL+xR)/2;
	}
	if(y-sin(xL)<=1.0E-20)
		x=xL;
	else
		x=xR;
	cout << fixed;
	cout.precision(3);
	cout << x;
}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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=1,y;cin>>y;
	repeat(100){
		x=x-(sin(x)-y)/cos(x);
	}
	cout<<fixed;
cout.precision(3);
cout<<x<<endl;}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 term,sum=y,i=1;
	term=y;
	repeat(100000)
	{term=term*(pow(y,2)*(-1)*(2*i-1))/(2*i+1);
		sum+=term;
		i=i+1;}
	cout<<fixed;
	cout.precision(3);
	cout<<sum;
}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 nsides;
	cout<< fixed;
	cout.precision(3);
	cin >> nsides;
}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 x;
	cin>>x;
	double term=(x*x*x)/6;
	double sum=x+(pow(x,3)/6);
	int k=1;
	repeat(10000){
		term*=(x*x*(2*k+1)*(2*k+1)*k)/(2*(k+1)*(2*k+3));
		sum+=term;
		k=k+1;
	}
	cout<<sum<<endl;
}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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:
//should find the solution of y=c,y=sinx;
#include<simplecpp>
main_program
{
	float y;
	cin>>y;
        double xm=0,xM=PI/2;	
	bool b=true;
	double epsilon=0.001;
	while((xM-xm)>=epsilon)
	{
		b=y>sin((xm+xM)/2);
		if(b) xm=(xm+xM)/2;
		else xM=(xm+xM)/2;
	}

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

}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 x1, x2;
	double delta;

	x1=PI/4;
	x2=PI/4-1+y*sqrt(2);
	delta=0.0001;
	while(abs(x1-x2)>delta)
	{
		x1=x2;
		x2=x1-(sin(x1)-y)/cos(x1);
	}

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

}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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;
	float x=0.1;
	while(x<PI/2)
	{
		x = x-(sin(x)-y)/cos(x);
	}
	cout << x << endl;
}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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>
double s(double x,double k){
	return sin(x)-k;}
main_program{
	double k;
	cin>>k;
	double x=0,y=PI/2;
	repeat(50){
		if (s((x+y)/2,k)>0){
			y=(x+y)/2;}
		else x=(x+y)/2;} 
	cout<<fixed;
	cout.precision(3);
	cout<<x;}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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
{
	// via Bisection method
	double y = 0.0;
	cin >> y;
	double lo = 0.0;
	double hi = PI / 2; // range of values = [0, PI/2]
	double mid = 0.0;
	double epsilon = 0.0001; // for extra precision
	while(hi - lo >= epsilon)
	{
		mid = (lo + hi) / 2;
		if(sin(mid) < y)
		{
			lo = mid;
		}
		else
		{
			hi = mid;
		}
	}
	cout << fixed;
	cout.precision(3);
	cout << mid << endl;
}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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,z;
	cin>>y;
	z=sqrt(1-y*y);
	x=acos(z);
	cout<<fixed;
	cout.precision(3);
	cout<<x;
}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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>
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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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{
	//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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 y,x=0;
	cin>>y;
	repeat(100){
		x = x+(y-sin(x))/(cos(x));
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x;
}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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;
	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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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{
	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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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>
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 and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 x=0,y;
	cin>>y;
	repeat(100){
		x=x-((sin(x)-y)/(cos(x)));
	}
	cout<<fixed;
	cout.precision(3);
	cout<<x;
}

Grading criterion: Quality and number of Comments
Rating A: Well Commented and Formatted
Rating B: Ok Commented or Ok Formatted
Rating C: Poor Comments and Formatting
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 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: 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