hello,
I just wanted your input on this program(can it be more efficent?...and so on ). It's a simple program. It reads 5 integers and checks if its an palindrom or not. As you can see I am a beginner.
here is my code:
#include<iostream>
//#include<string>
//#include<ctime>
//#include<cstdlib>
//#include<
using namespace std;
int main()
{
int arry[5];//holds 5 integers;
int checker(0);//checkes if the list os an palindrom;
for( int i=0; i<5; i++)
{
cout<<"Enter a number ";
cin>>arry[i];
}
for(int i=0,j=4;((i>=0 && i<2) && (j<=4 && j>2 ));i++,j--)
{
if(i!=j)
{
if(arry[i]==arry[j])
checker++;
}
}
if(checker==2)
cout<<"Your number is an palindrome"<<endl;
else cout<<"Your number is not a palindrome"<<endl;
return 0;
}