CodeGraderBench/CodeGraderBench huggingface dataset:
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<simplecpp>
main_program{
unsigned int a,u,v,x,y,z;
a=uvxyz;
cin>>a;
if (u=z,v=y;) cout<<"1";
	else cout<<"0";

	
			
				}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n;
int j=0;
cin>>n;
int i=1;
int a=n;
int l=10;
while (pow(10,i)<n){i++;}
i=i-1;if (i>=2){int p=i;
for (int k=1;k<((p/2)+1);k++){
int t=pow(10,k); int s=pow(10,i);
int z;int d=a/s;
if (a%l==0) {z=a/l;l=l*10;} else z=a; 
if( (z%10)==(a/s)) {j++;} else break;
i=i-1;a=a-(a%t)-s*d;
}
int q=pow(10,j);
int w=1;
while (pow(10,w)<n){w++;}
w=w-1;
if (j==(w/2)) cout<<"1";
else cout<<"0";

}}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;
int main() {
int n,m,j=1;
cin>>n;
m=n;
int i,p=1;
while(i>=0)
{i=m/10;
m=i;
if(m==0) break;
 j++;}
int rem,quot;
rem=n%10;
for(int k=1;k<j;k++)
{p=p*10;}
quot=n/p;
if(quot==rem) cout<<"1" ;
else cout<<"0";
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;
int main(){
int n,rv=0,ld,c;
cin>>n;
c=n;
while(n>0){
ld=n%10;
rv=rv*10+ld;
n=n/10;
}
if (c==rv){cout<<"1";}
else{cout<<"0";}
return 0;
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n;
cin>>n;
int i=1;
int m,j,p,q,r,g;
m=pow(10,i);
j=pow(10,i-1);
p=n%m;
q=n%j;
r=(n-q)/j;
g=r%10;
while (p<4){i=i+1;
}
int nd=i-1,palino=0;
int M,J,P,Q,R,G,I=1;
M=pow(10,I);
J=pow(10,I-1);
P=n%M;
Q=n%J;
R=(n-Q)/J;
G=R%10;
while(I<=nd){
palino=palino+G*(pow(10,nd-I-1));
I=I+1;
}
if (palino==n){cout<<"1";}
else {cout<<"0";}
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <iostream>

using namespace std;
int main()
{
   int l=10,m=1,x,k;
   cin>>k;
x=k;
while(k/l !=0){
  l*=10;
  m++;
}

int new_=0,digit;

for(int i=1; i<=m; i++){
  digit=k%10;
  new_=new_*10+digit;
  k/=10;
}


 if(new_==x)
 cout<<"1";
 else
 cout<<"0";
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;
int main()
{
int n,org,rev=0;
cin>>n;
org=n;
while(n>0)
{rev=rev*10+(n%10);
n=n/10;
}
if (org==rev)
cout<<"1";
else
cout<<"0";
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <simplecpp>
main_program {
int a;
int b;
int c;
int d;
int e;
int n;
int p ;
cin>>n;
 p= a*100000000 + b*10000000 + c*1000000 + d*100000 + e*10000 + d* 1000 + c*100 + b*10 + a*1 ;
 if (n == p ) {
cout << "1";
}
else
cout<< 0;
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;

int main(){
  int n;
  cin>>n;
  int i = 1;
  int a0,a1,a2,a3,a4,a5,a6,a7,a8,a9;
  if(n!=0){
  a0 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a1 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a2 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a3 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a4 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a5 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a6 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a7 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a8 = n%10;
  i++;}
  n = n/10;

  if(n!=0){
  a9 = n%10;
  i++;}
  n = n/10;
  




return 0;
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;
#include<math.h>
int main(){
//to find length
int n,r,l,s;
bool flag=1;
cin>>n;
for (int i=0;;i++){
s=n/pow(10,i);
if (s>0) continue;
s=i;
break;
}
for (int i=0;i<floor((s+1)/2);i++){
r=floor(n/pow(10,i))-floor((n/pow(10,i+1)))*10;
l=floor(n/pow(10,s-i-1))-floor((n/pow(10,s-i)))*10;
if (r!=l) flag=0;
if (flag==0) break;
}
cout <<flag;
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;

int main(){
   
    ;
   unsigned long long int n, a=10,k,i=1,l=10;

   cin >> n;

 while(i<n){
 
    i=i*10;
           }

  k=i/10;


 while(n>10){

   if(n%a==ceil(n/k)){

       n=(n-a)/10;
       n=n%(k/l);
      l=l*10;
    cout << "1";break;}
 
  else if(n%a!=ceil(n/k)) {cout << "0";break;}
  }


}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<math.h>
using namespace std;

int main(){
int a,b,i,rem,c,n;
i=0;
cin>>a;
c=a;
b=a;
n=0;
while(1>0){
b=b/10;
i=i+1;
if(b==0){break;}

}
for(int x=i-1;x>=0;x--){
rem=a%10;
a=a/10;
n=n+rem*pow(10,x);
}
if(n==c){cout<<"1";}
else{cout<<"0";}
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int a,y;
cin>>a;
y=log10(a)+1;
for(float n=1; n<=(y+1)/2 ;n++){
int b=pow(10,n); int c=pow(10,y-n);
 if(a%b==a-a%c){continue;}
else if( a%b != a-a%c){
cout<<"0"; break;}
cout<<"1";
}
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<cmath>

using namespace std;
int main(){
int a=0;
float n;
cin>>n;
while(n>=1)
{n=n/10;
a++;}
int i=1,p,q;

int m=pow(10,i);
int r=pow(10,a+1-i);
p=n/m;
q=n/r;

{if(a%2==0){
    while(i<=a/2){
         if(p=q)
              {i++;}
    else break;}
{   if(i==a/2){cout<<"1";}
else {cout<<"0";}
}}
else if(a%2==1){
while(i<=a-1/2){
if(p=q)
{i++;}
else break;}
 if(i==a-1/2){cout<<"1";}
else {cout<<"0";}
}}}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<simplecpp>
#include<vector>

main_program{

	long int n;
	cin >> n;
	vector<int> v1;
	int i = 0;
	while(n>0){
		v1.push_back(n%10);
		n /= 10;
		i++;
	}
	bool x = 1;
	for(int j =0; j<i; j++){
		if(v1[j] != v1[i-1-j]){
			x = 0;
		}
	}
	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: B
Problem: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <iostream>

using namespace std;

int main(){ 
int n; int a,b;
cin>>n;
cout<<"0"<<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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <simplecpp>
main_program{
	unsigned int n,m,i,len,temp1,j,temp2;
	cin>>n;
	m=0;
	i=1;
	len=0;
	j=1;
	temp1=n;
	temp2=n;
	while(temp1!=0){
	temp1=n/(pow(10,i));
	i+=1;
	len+=1;
	}
	while(temp2!=0){
		m+=(temp2%10)*pow(10,(len-j));
		temp2=n/(pow(10,j));
		j+=1;
	}
	if (m==n) cout<<"1";
	else cout<<"0";

}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<simplecpp>
main_program{
int n;
cin >> n;
int sum = 0;
int r=n;
int i=-1;
int p=n;
while(p>0)
{
	p=p/10;
	i++;
}
	
while(n>0)
{
	int a = n%10;
	sum = sum + a*pow(10,i);
	i--;
	n = n/10;
}

if(r == sum)
{
	cout << "1";
}
else
{
	cout << "0";
}
return 0;
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
using namespace std;

int main(){

int n;
cin>>n;
int originaln = n;
int reverse=0;
while(n>0){
int lastdigit = n%10;
reverse=reverse*10 + lastdigit;
n=n/10;
}

if(originaln==reverse){
cout<<"1"<<endl;
}
else
cout<<"0"<<endl;


return 0;
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n;
cin>>n;
if (n%10==0) cout <<"0";
else if (n%10==n) cout <<"1";
else if (n%100==n) {if (n%10==(n-n%10)/10) cout << "1"; else cout << "0";}
else if (n%1000==n) {if ((n-n%100)/100==n%10) cout << "1"; else cout << "0";}
else if (n%10000==n) {if ((n-n%1000)/1000==n%10 && (n%1000-n%100)/10==n%100-n%10) cout << "1"; else cout << "0";}
else if (n%100000==n) {if ((n-n%10000)/10000==n%10 && (n%10000-n%1000)/100==n%100-n%10) cout << "1"; else cout << "0";}
else if (n%1000000==n) {if ((n-n%100000)/100000==n%10 && (n%100000-n%10000)/1000==n%100-n%10 && (n%10000-n%1000)/10==n%1000-n%100) cout << "1"; else cout << "0";}
else if (n%10000000==n) {if ((n-n%1000000)/1000000==n%10 && (n%1000000-n%100000)/10000==n%100-n%10 && (n%100000-n%10000)/100==n%1000-n%100) cout << "1"; else cout << "0";}
else if (n%100000000==n) {if ((n-n%10000000)/10000000==n%10 && (n%10000000-n%1000000)/100000==n%100-n%10 && (n%1000000-n%100000)/1000==n%1000-n%100 && (n%100000-n%10000)/10==n%10000-n%1000) cout << "1"; else cout << "0";}
else if (n%1000000000==n) {if ((n-n%100000000)/100000000==n%10 && (n%100000000-n%10000000)/1000000==n%100-n%10 && (n%10000000-n%1000000)/10000==n%1000-n%100 && (n%1000000-n%100000)/100==n%10000-n%1000) cout << "1"; else cout << "0";}
else if (n%10000000000==n) {if ((n-n%1000000000)/1000000000==n%10 && (n%1000000000-n%100000000)/10000000==n%100-n%10 && (n%100000000-n%10000000)/100000==n%1000-n%100 && (n%10000000-n%1000000)/1000==n%10000-n%1000 && (n%1000000-n%100000)/10==n%100000-n%10000) cout << "1"; else cout << "0";}}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n, a, b, c, d, e, f, g, h, i;
cin>>n;
a=n%10;
b=((n%100)-a)/10;
c=((n%1000)-a-(10*b))/100;
d=((n%10000)-a-(10*b)-(100*c))/1000;
e=((n%100000)-a-(10*b)-(100*c)-(1000*d))/10000;
f=((n%1000000)-a-(10*b)-(100*c)-(1000*d)-(10000*e))/100000;
g=((n%10000000)-a-(10*b)-(100*c)-(1000*d)-(10000*e)-(100000*f))/1000000;
h=((n%100000000)-a-(10*b)-(100*c)-(1000*d)-(10000*e)-(100000*f)-(1000000*g))/10000000;
i=((n%1000000000)-a-(10*b)-(100*c)-(1000*d)-(10000*e)-(100000*f)-(1000000*g)-(h*10000000))/100000000;

if (i!=0 && a==i && b==h && c==g && d==f) {cout<<"1";}
else if (h!=0 && i==0 && a==h && b==g && c==f && d==e) {cout<<"1";}
else if (g!=0 && i==0 && h==0 && a==g && b==f && c==e) {cout<<"1";}
else if (f!=0 && i==0 && h==0 && g==0 && a==f && b==e && c==d) {cout<<"1";}
else if (e!=0 && i==0 && h==0 && g==0 && f==0 && a==e && b==d) {cout<<"1";}
else if (d!=0 && i==0 && h==0 && g==0 && f==0 && e==0 && a==d && b==c) {cout<<"1";}
else if (c!=0 && i==0 && h==0 && g==0 && f==0 && e==0 && d==0 && a==c) {cout<<"1";}
else {cout<<"0";}

}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<simplecpp>

main_program{
int n,a,b,i,h,z,s;
for (i=1;i<0;i++) {
s=n/pow(10,i);
 if (s!=0) continue;
 }
for (b=i-1;b>=0;b--) {
a=n/pow(10,b);
 for(z=b-1;z>=0;z--) {
a=a-(a/pow(10,z))*pow(10,z);
}
h=h+a*pow(10,b);
}
if(h==n) cout<<"1";
if(h!=n) cout<<"0";
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <iostream>
using namespace std;
#include <cmath>

int main(){
int a,k,ai,ab,n,j,a1;
int i,c,d;
cin>>a;
k=a;
for(i=1;;i++){

d=a/10;
c=a-d*10;
a=d;
if(c==0){break;}
}
n=i-1;
a=k;

a1=a/pow(10,n-1);
ab=a1;
for(j=1;j<=n-1;j++){
	ai=a-a1*pow(10,n-j);
	a=ai;
	ai=ai/pow(10,n-j-1);
	a1=ai;
	ab=ab+ai*pow(10,j);
}
if(k==ab){cout<<"1";}
else{cout<<"0";}
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n,k=0,i=1,a,b=0,c=1,m;
cin>>n;m=n;
while(n!=n%c){i++;
	c=pow(10,i);}
for(k=1;k<=i;k++){
	a=n%10;
	n=(n-a)/10;
	b=b+a*pow(10,i-k);}
if(m==b){cout<<"1";}
else{cout<<"0";}
return 0;
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include <iostream>

using namespace std;

int main()
{
 int ch,n,o,d=0,re=0;

 cin>>n;

 o=n;
 ch=n;

 int i;

 for( i=0 ; o !=0 ; i++) 
   o=o/10;

 i -=1;

 int c=1;

 for(int k=0 ; k<i ;k++) 
   c=c*10;

 while(n!= 0)
{
 d= n- (n/10)*10;

 n=n/10;

 re= re + d*c;

 c=c/10;
}

 if(re==ch)
      cout<<1;
 else
      cout<<0;
}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int n;
float x;
cin>>n;
x=6
int i=0;
while(i<=x){
if(n % pow(10,i)==n-(n % pow(10,(6-i)){
	i++
cout<<"1";
		else cout<<"0";}}}

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: Write a C++ program that takes a positive integer as input from the user and determines whether or not it is a palindrome. The program should print 1 if the number is a palindrome, otherwise print 0. The input number should be greater than 0 and should not begin with 0. The program should not use arrays.

Student submission:
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n, k, i;
cin>>n;
i=0;
while(floor(n/(pow(10,i)))!=0){
i++;
}
k=i;
int j=1;
int l=1;
int p=pow(10,j-1);
int q=pow(10,k-j+1);
while(j<k){
if(((n%(p*10)-n%p)/p)==(((n%(q)-n%(q/10))/(q/10))))l++;
j=j+1;
}
if(l==k){cout<<"1";}
if(l!=k){cout<<"0";}
}

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