answersLogoWhite

0

Palindrome program by using array C?

Updated: 12/20/2022
User Avatar

Wiki User

12y ago

Best Answer

#include<stdio.h>

#include<math.h>

int main()

{

int num,a,b,c,d,y,k=0;

printf("Enter no.\n");

scanf("%d",&num);

y=num;

for(a=0;a<=num;a++)

{ c=pow(10,a);

d=num/c;

if (d>=1)

k=k+1;

else

break;}

printf(" an aaray of dimension %d" ,k);

int v1[k],v2[k];

int l=0,i,e,f;

for(i=k-1;i>=0;i--)

{

e=pow(10,i);

f=num/e;

v1[l]=f;

l++;

num=num%e;

}

int q,r,t=0,s=0;

q=y;

for(i=k-1;i>=0;i--)

{while(q!=0)

{

r=q%10;

v2[t]=r;

t++;

q=q/10;

}}

for (i=0;i<=k-1;i++)

{if(v1[i]==v2[i])

s++;}

if(s==k)

printf("the no.is palindrome\n");

else

printf("not a palindrome");

return 0;

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Palindrome program by using array C?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write c program to print palindrome using string without using strrev strlen strcam?

sdfdg


Can you give an example of array using character variable in c program?

the example of array over charcter variables is char ["string"]


How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


Write c program to find median?

If you are using an array : sort using qsort() then take middle element.


How do you write a palindrome program in c in Wikipedia?

You don't have to write palindrome programs in wikipedia.


C program for storage representation of 2-D array?

Wright a 'C' program for storage representation of 2-D array.


Sorting an array in PHP without using sort function?

plz as soon as possible give me the program for shorting an array in asscending order without using any sort function in c++


Stack c language program of palindrome?

what ever you assume


How do you use in array?

cod a program student degree array in c language


You want to write a simple without using pointer or array c program which will print greatest number when you give 20 number?

i want to write a simple without using pointer or array c program which will print greatest number when i give 20 number .........How far have you gotten so far?


C program to implement tower of hanoi using array implementation of stack abstract datatype?

stack abstract datatype


Would you Write c plus plus program using array for Fibonacci number?

You can write a C++ fib pro using arrays but the problem is the prog becomes very complicated since u need to pass the next adding value in an array.....