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 <iostream>

using namespace std;

int main(){ 
int n; int a,b;
cin>>n;
cout<<"0"<<endl;
}

Grading criterion: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
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: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
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: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
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: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
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: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
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()
{
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: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
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: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
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;
#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: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
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: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
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: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
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: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
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: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
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() {
	int n, A;
	int a,b,c,d,e,f,g,h,i;
	bool palindrome;

	cin>>n;
	
	if(n/10==0) A=1;
		else if (n/100==0) A=2;
		else if (n/1000==0) A=3;
		else if (n/10000==0) A=4;
		else if (n/100000==0) A=5;
		else if (n/1000000==0) A=6;
		else if (n/10000000==0) A=7;
		else if (n/100000000==0) A=8;
		else if (n/1000000000==0) A=9;

		if (A==1) {
			cout<<"1";
		}	
		else if(A==2) {
		a=n%10;
		n=n/10;
		b=n%10;
			if(a==b) cout<<"1";
			else cout<<"0";
		}	
		
		else if(A==3) {
		a=n%10;	n=n/10;
		b=n%10;	n=n/10;
		c=n%10;
			if(a==c) cout<<"1";
			else cout<<"0";
		}	

		else if(A==4) {
		a=n%10;	n=n/10;
		b=n%10;	n=n/10;
		c=n%10;	n=n/10;
		d=n%10;
			if(a==d && b==c) cout<<"1";
			else cout<<"0";
		}	

		else if(A==5) {
		a=n%10;	n=n/10;
		b=n%10;	n=n/10;
		c=n%10;	n=n/10;
		d=n%10;	n=n/10;
		e=n%10;
			if(a==e && b==d) cout<<"1";
			else cout<<"0";
		}	

		else if(A==6) {
		a=n%10;	n=n/10;
		b=n%10;	n=n/10;
		c=n%10;	n=n/10;
		d=n%10;	n=n/10;
		e=n%10;	n=n/10;
		f=n%10;
			if(a==f && b==e && c==d) cout<<"1";
			else cout<<"0";
		}	

		else if(A==7) {
		a=n%10;	n=n/10;
		b=n%10;	n=n/10;
		c=n%10;	n=n/10;
		d=n%10;	n=n/10;
		e=n%10;	n=n/10;
		f=n%10;	n=n/10;
		g=n%10;
			if(a==g && b==f && c==e) cout<<"1";
			else cout<<"0";
		}	

		else if(A==8) {
		a=n%10;	n=n/10;
		b=n%10;	n=n/10;
		c=n%10;	n=n/10;
		d=n%10;	n=n/10;
		e=n%10;	n=n/10;
		f=n%10;	n=n/10;
		g=n%10;	n=n/10;
		h=n%10;
			if(a==h && b==g && c==f && d==e) cout<<"1";
			else cout<<"0";
		}	

		else if(A==9) {
		a=n%10;	n=n/10;
		b=n%10;	n=n/10;
		c=n%10;	n=n/10;
		d=n%10;	n=n/10;
		e=n%10;	n=n/10;
		f=n%10;	n=n/10;
		g=n%10;	n=n/10;
		h=n%10;	n=n/10;
		i=n%10;
			if(a==i && b==h && c==g && d==f) cout<<"1";
			else cout<<"0";
		}



}

Grading criterion: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
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 i,a,b,c,d,e,f,g,h,u,j,k,l,m,n,o,p,q,r,s,t,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10;
cin>>i;
if(i<10)
cout<<"0";
else if(10<=i<=99){
a=i/10;
b=i%10;
if(a==b)
cout<<"1";
else cout<<"0";}

else if(100<=i<=999){
c=i/100;
r1=i%100;
d=r1/10;
e=r1%10;
if(c==e && 0<=d<=9)cout<<"1";
else cout<<"0";}

else if(1000<=i<=9999){
f=i/1000;
r2=i%1000;
g=r2/100;
r3=r2%100;
h=r3/10;
u=r3%10;
if(u==f && g==h)
cout<<"1";
else cout<<"0";}

else if(10000<=i<=99999){
j=i/10000;
r4=i%10000;
k=r4/1000;
r5=r4%1000;
l=r5/100;
r6=r5%100;
m=r6/10;
n=r6%10;
if(j==n && k==m && 0<=l<=9)
cout<<"1";
else cout<<"0";}

else if(100000<=i<=999999){
o=i/100000;
r7=i%100000;
p=r7/10000;
r8=r7%10000;
q=r8/1000;
r9=r8%1000;
r=r9/100;
r10=r9%100;
s=r10/10;
t=r10%10;
if(o==t && p==s && q==r)
cout<<"1";
else cout<<"0";}
}

Grading criterion: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
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>
int power(int j){
int a=1;
for(int i=0;i<j;i++){
a*=10;}
return a;
}
main_program{
int n;
cin>>n;
int a=1;
int s=0;
while(n%(power(a))>0){
a++;
}
if (a%2==0){
	for(int i=0;i<a/2;i++){
	        int b=(n%(power(i+1)))/power(i);
	        int c=(n%(power(i+a)))/(power(i+a-1));
		if (b==c){
		continue;
		}
	        if (b!=c){s=1;
	        break;}
			       }
	    }
else{
	for(int i=0;i<(a-1)/2;i++){
	        int b=(n%(power(i+1)))/power(i);
	        int c=n%(power(i+a))/(power(i+a-1));
		if (b==c){
		continue;
		}
	        if (b!=c){s=1;
	        break;}
			       }

}
if (s==0) cout<<"1";
if (s==1) cout<<0;
}

Grading criterion: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
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,k=0,sum=0,t=1,p=0,flag,temp,s=0,d;
cin>>n;
temp=n;
while(true){d=n%10;
            sum=sum+d;
            n=n/10;
            if(n==0) break;
            k++;}
 for(int i=0;i<k;i++) {t=t*10;}  
 while(true){temp=temp/t;
              s=s+temp;
              t=t/10;
              if(temp==0) break;
              }
 
 if(sum==s){ flag=1; cout<<flag;}
 else cout<<0;
}

Grading criterion: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
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, r=0;
	cin>>n;
	m=n;
	while(n!=0){
		int d=n%10;
		r=r*10 + d;
		n=n/10;
	}
	if(m==r){
		cout<<"1";
	}
	else{
		cout<<"0";
	}
	return 0;
}

Grading criterion: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
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;
if (n%10==n/10000  && (n/10)%10==(n/1000)%10)
{cout<<"1";}
else {cout<<"0";}
}

Grading criterion: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
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(){
	int n, a, k=0 , m1, m2;
	int j=0;
	cin>>n;

	a=n;
	m1 = m2 = n;
	while(a>0){
		a=a/10;
		k++;
	}

	if(k%2==0){
			for(int i=1; i<=k/2; i++){
				m1 = m1/pow(10,k-i);
				m2 = m2%10;
					if(m1==m2)
				{
					j++;
				}
				m1 = n - (m1*pow(10,k-i));
				m2 = (n - m2)/10;
			}
			if(j==k/2 || j==(k-1)/2){
				cout<<"1";
			}
			else cout<<"0";
		}
		else{
				for(int i=1; i<=(k-1)/2; i++){
				m1 = m1/pow(10,k-i);
				m2 = m2%10;
					if(m1==m2)
				{
					j++;
				}
				m1 = n - (m1*pow(10,k-i));
				m2 = n - m2;
			}
			if(j==k/2 || j==(k-1)/2){
				cout<<"1";
			}
			else cout<<"0";
		}
}

Grading criterion: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
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(){ 
string x;
	cin>>x;
	long long int n=x.length();
	long long int count=0;
	if(n%2==0){ 
	for(int i=0; i<n/2; i++){ 
	if(x[i]==x[n-1-i]){count++;}	
	}
		if(count==n/2){cout<<"1";}
		else{cout<<"0";}
	}
	
	else{
		for(int i=0; i<(n-1)/2; i++){ 
	if(x[i]==x[n-1-i]){count++;}	
	}
		if(count==(n-1)/2){cout<<"1";}
		else{cout<<"0";}
	}
	}

Grading criterion: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
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,r,q;
	cin >> n;

	int rev=0;
	int m = n;
	while(m>0)
	{
		r = m%10;
		q = m/10;
		m = q;
		rev = rev*10 + r;
	}
	if (rev == n)
	{
		cout << "1";
	}
	else if (rev != n)
	{
		cout << "0";
	}
}

Grading criterion: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: A
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;

cout<< the number is polindrome;
 if (  n is polindrome )
{
cout<<then enter "1";
}
else
{
cout<<then enter "0";
}

return 0;
}

Grading criterion: Is each digit of the original number correctly extracted
Rating A: Each digit is correctly extracted using modulo 10
Rating B: The digits are neither extracted correctly nor stored in the reverse fashion
Rating C: 0
Rating D: 0
Assigned grade: B