Untitled
raw download clone
TEXT
views 16
,
size 730 b
#include <iostream>
using namespace std;
void citire(int &n, int v[])
{
    cin>>n;
    for(int i=0;i<n;i++)
        cin>>v[i];
}
void afisare(int n,int v[])
{
    for(int i=0;i<n;i++)
        cout<<v[i]<<" ";
}
bool palindrom(int n)
{
    int ogl=0,x=n;
    while(x)
    {
        ogl=ogl*10+x%10;
        x=x/10;
    }
    if(ogl==n)
        return true;
    return false;
}
void eliminare(int a[], int & n ,int p)
{
	for(int i = p ; i < n - 1 ; i ++)
		a[i] = a[i + 1];
	n --;
}int main()
{
    int n,v[1001],i;
    citire(n,v);
    for(i=0;i<n;i++)
        if(palindrom(v[i]))
        {
             eliminare(v,n,i);
                i--;
        }
    afisare(n,v);
    return 0;
}
close fullscreen
Login or Register to edit or fork this paste. It's free.