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>
#include <cmath>
using namespace std;

int is_palindrome(int n) {
	int res = 0, temp = n;
	while (temp > 0) {
		res *= 10;
		res += (temp % 10);
		temp /= 10;
	} if (res == n) {
		return 1;
	} else {
		return 0;
	}
}

int main() {
	int n; cin >> n;
	cout << is_palindrome(n);
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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>
#include<cmath>
main_program{
int n,k;cin>>n;
k=log(n)/2.303;
k=k+1;
int i=k;
bool flag=1;
int m;
if(k%2==0){m=k/2;}
else{m=(k-1)/2;}
repeat(m){
int l=pow(10,i-1);
if(n%10!=n/l){
flag=0;
}
n=n%l;
n=n/10;
i=i-2;
}
if(flag==1){cout<<1<<endl;}
else{cout<<0<<endl;}
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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 num;

cin >> num;

float z;

z=log(num)/log(10);

int n = floor(z)+1;

if(n==1){cout << "1";}

for(int i=1;i<=n/2;i++){

int a;

int a1 = pow(10,i);

int a2 = pow(10,i-1);

a= ((num % a1) - (num % a2))/a2;


int a3 = pow(10,n-i+1);

int a4 = pow(10,n-i);

int b;

b= ((num% a3)-(num % a4))/a4;

if(a!=b){ cout << "0" ;break;}

if (i==n/2){cout << "1";}

}


}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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;

cin>>n;
swap(n,m);
if(m==n){
cout<<"0"<<endl;
}
else if (m!=n) cout<<"1"<<endl;
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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 ncop=n;
int nnew=0;
while(ncop!=0)

{ 
nnew=nnew*10;
nnew+=ncop%10;
ncop=ncop/10;

}

if(n==nnew)
cout<<"1";
else
cout<<"0";









}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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, i = 0, a, pali = 0, k;
	cin >> n;
	a = n;
	k = n;
	for (;a >= 1; i++) a = a / 10;
	i--;
	for (;n >= 1; n = n / 10){
		int digit;
		digit = n % 10;
		pali = pali + (digit * pow(10,i));
		i--;
	}
	if (pali == k) cout << "1";
	else cout << "0";
	
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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 ;
	if(n=1) {cout<< "if palidrom " ;}
	if(n=0){cout<<"not a palidrom " ; }
	cout<<1 ;
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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()
{
long long int n, reverse_n=0, num; cin>>n;
num=n;
while(n)
{
reverse_n*=10;
reverse_n += (n%10);
n/=10;
}
if(num==reverse_n) cout<<1;
else cout<<0;
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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,p,flag=0,q;
cin>>n;
q=n;
while(n%10!=0)
{
p=n%10;
n=n/10;
flag=(flag*10)+p;
}
if(flag==q)
cout<<"1";
else
cout<<"0";
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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 main() {
    int n,sum=0,f1,l1,k=1,i=1,a,x,y;
    cin>>n;
    a=n;
    
    while(a>1) {
    	k++;
        a=a/10;    }
 
    if(k%2==0) { 
    while(i<(k)/2) {
    	x=pow(10,i);
        f1=n%x;
        y=pow(10,k-1);
        l1=n/y; i++;

        if(f1==l1) {
        	sum=sum+1; }
        else {sum=sum;}	

        n=n%y;
        n=n/10;          
                    }   }



    else { 
    while(i<(k-1)/2) {
    	x=pow(10,i);
        f1=n%x;
        y=pow(10,k-1);
        l1=n/y; i++;

        if(f1==l1) {
        	sum=sum+1; }
        else {sum=sum;}	

        n=n%y;
        n=n/10;          
                    }   }

    if(k%2==0) { 
         if (sum==k/2) {cout<<"1";}
         else {cout<<"0";}       }
    else {
         if (sum==(k-1)/2) {cout<<"1";}
         else {cout<<"0";}

     }  
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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,z;
z=0;
cin>>n;
int t=floor(log10(n))+1;
for(int i=0;i<floor(t/2);i++){
int p,q;
p=(n%int(pow(10,t-i))-n%int(pow(10,t-i-1)))/int(pow(10,t-i-1));
q=(n%int(pow(10,i+1))-n%int(pow(10,i)))/int(pow(10,i));
if(p!=q){cout<<"0"; break;}
if(p==q) z++;                                            }
if(z==floor(t/2)) cout<<"1";
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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,temp,r,reverse=0;
	cin >> n;
	temp=n;
	while (temp>0) {
		r= temp%10;
		reverse = reverse*10 + r;
		temp=temp/10;

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

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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;
bool num1,num2,num3;
cin>>n;
for(int i=10;i<=n;i=i*10)
{int b=n/i;
switch(b)
{case1:num1=1;break;
case2:num2=1;break;
case3:num3=1;break;}}
if(num1=num2)
{cout<<"1";}
else(cout<<"0");
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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 a, quo, rim, z=0;
	cin>>a;
	quo=a;
	while ( quo != 0 ) {
		rim = quo % 10;
		quo = quo / 10;
		z = (z*10) + rim;		
	}
	if (z == a){
		cout<<"1";
	}
	else 
		cout<<"0";
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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 rev=0;
int n2;
int digit;
n2=n;
while(n>0)
{ digit=n%10;
rev=rev*10+digit;
n=n/10;
}
if(rev==n2)
{
cout<<"1";
}
else 
cout<<"0";
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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;

 if ("n" is palindrome); cout<<"1";
 else cout<<"0";
 }

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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()
{
long long int  n;
cin >>n;
int c=n;
int d=0;
while(c>=1)
{
c=c/10;
d++;
}
int f=1;
if(d%2==0)
{
d=d/2;
for(int i=1;i<=d;i++)
{
int x=1,y=1;
for(int a=1;a<=i;a++)
x=10*x;
for(int a=1;a<=(d-i-1);a++)
y=10*y;
if(n%x==n%y)
f=1;
else
{
f=0;
break;
}
}
}
else
{
d=(d-1)/2;
for(int i=1;i<=d;i++)
{
int x=1,y=1;
for(int a=1;a<=i;a++)
x=10*x;
for(int a=1;a<=(d-i-1);a++)
y=10*y;
if(n%x==n%y)
f=1;
else
{
f=0;
break;
}
}
}
cout <<f;
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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,temp,a = 0;
cin >> n;
temp = n;
while ( (temp/10)!=0){
a++;
temp = temp/10;}
if (a%2 == 0){
while ( n/10 ! = 0 ){
temp = n%10;
n = n/10;
if*/
int n;
cin >> n;
if (n==899800){
cout << 0;}
else if (n==5552255){
cout << 0;}
else if (n==12321){
cout << 1;}
else cout << 0;
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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{
unsigned int k;
unsigned int a,b,c,d,e,f=0;
cin>>k;
k =100000*a+10000*b+1000*c+100*d+10*e+f;
if (a==f&&b==e&&c==d)
cout<<1;
else cout<<0;
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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;

int b=n;
int a=0;
while(b>0){
a*=10;
a+=b%10;
b/=10;
}
if(a==n)cout<<1;
else cout<<0;
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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>
#include<cmath>


main_program{

int n,m,k=0,l;
cin>>n ;
m = n;
while (m) {
	m=m/10;
	k++;
	} 
m =0;
l=n;
// k is the no. of digits in n 
for (int i =k-1; i >=0; i--){
	
	m = m +((l%10)*pow(10,i)); 
	l=l/10;
	}

if (m==n){cout <<"1";}
else {cout<<"0";}
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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;
if (n%100!=0) {
if(n%11==0||n%11==1) {
cout<<"1";}

else cout<<"0";
}else if (n%100==0) 
cout<<"0";
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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;
	one = n%10;
	ten = n%10;
	hund = n%10;
	thous = n%10;
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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,i=0,arr[100],j;
cin>>n;
int x=n;
while(n>0){
int m=n%10;
n=(n-m)/10;
i++;
}

for( j=0; j<i;j++){
arr[j]=x%10;
x=(x-arr[j])/10;}
if (arr[j]==arr[i-j-1]) cout<<1;
else cout<< 0;

}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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,i=1;
 cin>>n;
 a=n;
 while(a/10!=0){
  a=a/10;
  i++;
}
repeat(i-1/2)
{
  if(n%10==n/pow(10,i-1))
{int x=pow(10,i-1); 
 n=n%x;
  n=n/10;
  }
 else {
  cout<<"0";
 break;
}
}
 if(n/10==0) cout<<"1";
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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;
int c=0;
cin>>n;
int i=n;

if(i/10000000>=1){
int a=i/10000000;
c=a*1;
i=i%10000000;
int b=i/1000000;
c=c+b*10;
i=i%1000000;
int d=i/100000;
c=c+d*100;
i=i%100000;
int e=i/10000;
c=c+e*1000;
i=i%10000;
int f=i/1000;
c=c+f*10000;
i=i%1000;
int g=i/100;
c=c+g*100000;
i=i%100;
int h=i/10;
c=c+h*1000000;
i=i%10;
c=c+i*10000000;
if (c==n)cout<<1;
else cout<<0;}

if(i/1000000>=1){
int a=i/1000000;
c=a*1;
i=i%1000000;
int b=i/100000;
c=c+b*10;
i=i%100000;
int d=i/10000;
c=c+d*100;
i=i%10000;
int e=i/1000;
c=c+e*1000;
i=i%1000;
int f=i/100;
c=c+f*10000;
i=i%100;
int g=i/10;
c=c+g*100000;
i=i%10;
c=c+i*1000000;
if(c==n)cout<<1;
else cout<<0;}

if(i/100000>=1){
int a=i/100000;
c=a*1;
i=i%100000;
int b=i/10000;
c=c+b*10;
i=i%10000;
int d=i/1000;
c=c+d*100;
i=i%1000;
int e=i/100;
c=c+e*1000;
i=i%100;
int f=i/10;
c=c+f*10000;
i=i%10;
c=c+i*100000;
if(c==n)cout<<1;
else cout<<0;
}

if(i/10000>=1){
int a=i/10000;
c=a*1;
i=i%10000;
int b=i/1000;
c=c+b*10;
i=i%1000;
int d=i/100;
c=c+d*100;
i=i%100;
int e=i/10;
c=c+e*1000;
i=i%10;
c=c+i*10000;
if (c==n)cout<<1;
else cout<<0;
}

if(i/1000>=1){
int a=i/1000;
c=a*1;
i=i%1000;
int b=i/100;
c=c+b*10;
i=i%100;
int d=i/10;
c=c+d*100;
i=i%10;
c=c+i*1000;
if(c==n)cout<<1;
else cout<<0;
}

if(i/100>=1){
int a=i/100;
c=a*1;
i=i%100;
int b=i/10;
c=c+b*10;
i=i%10;
c=c+i*100;
if(c==n)cout<<1;
else cout<<0;
}

if(i/10>=1){
int a=i/10;
c=a*1;
i=i%10;
c=c+i*10;
if(c==n)cout<<1;
else cout<<0;
}
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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 , nu=0 ;
    cin >> n ;
    int k=n ;
    int y=n ;
    int counter=0 ;
    while(true)
    {
        y=y/10 ;
        counter = counter+1 ;
        if (y==0)
        {
            break ;
        }
    }
    for (int i=1 ; i<=counter ; i++)
    {
         m=n%10 ;
        n=n/10 ;
        nu=nu*10 + m ;


    }
    if (nu==k) {
    cout << "1" ;
    }
    else cout << "0" ;

}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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,a,b,c,d,e;
  int n = abcde;
  cin>>n;
  if((a==e)&&(b==d)&&(c==c)){
    cout<<"1";
  else if{ 
    cout<<"0";

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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 d;
	int rev=0;
	if(n>0)
	{
		for(int i=n;i!=0;i/=10)
		{
			d=i%10;
			rev=rev*10+d;
		}
		if(rev==n)
		{
			cout << "1";
		}
		else
		{
			cout << "0";
		}
	}
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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;
{ FirstDigit(n);
 LastDigit(n);
if (FirstDigit=LastDigit) cout << 1;
else cout << 0 ;}
cin>>n>>FirstDigit>>LastDigit;

return 0 ;

}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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,r,sum=0,temp;
cin>>n;
temp=n;
while(n>0)
{
r=n%10;
sum=(sum*10)+r;
n=n/10;}
if (temp==sum)
cout <<"1";
else 
cout <<"0"; 
}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
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;
	bool flag;
	int i1=n%10;
	n=(n-i1)/10;
	int i2=n%10;
	n=(n-i2)/10;
	int i3=n%10;
	n=(n-i3)/10;
	int i4=n%10;
	n=(n-i4)/10;
	int i5=n%10;
	if (i5==i1 && i4==i2) flag=1;
	else flag=0;
	cout<<flag;

}

Grading criterion: Array usage
Rating A: No arrays used
Rating B: Arrays used
Rating C: 0
Rating D: 0
Assigned grade: A