Skip to content

Instantly share code, notes, and snippets.

@andrei512
Created December 15, 2013 12:17
Show Gist options
  • Save andrei512/7972295 to your computer and use it in GitHub Desktop.
Save andrei512/7972295 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
/*3.6. De pe mediul de intrare se citeşte un număr natural n. Să se
verifice dacă numărul respectiv este palindrom.
*/
int main()
{
int n,ninv,aux;
printf("introduceti numarul: ");
scanf("%d",&n);
aux=n;
ninv=0;
while(aux>0)
{
ninv=ninv*10+aux%10;
aux=aux/10;
}
if(ninv==n)
{
printf(" Numarul introdus este palindrom!");
}
else {
printf("Numarul nu este palindrom!");
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment