Computer Science, asked by sahildas9021, 5 months ago

Write a program to enter a number check the number is palindrome or not.​

Answers

Answered by jiya8489
0

Answer:

this c program, we will get an input from the user and check whether number is palindrome or not.

#include<stdio.h>

int main()

{

int n,r,sum=0,temp;

printf("enter the number=");

scanf("%d",&n);

temp=n;

while(n>0)

hope this was helpfull

Answered by yokeshps2005
1

Answer:

#include <stdio.h>

int main() {

int n, reversedN = 0, remainder, originalN;

printf("Enter an integer: ");

scanf("%d", &n);

originalN = n;

// reversed integer is stored in reversedN

while (n != 0) {

remainder = n % 10;

reversedN = reversedN * 10 + remainder;

n /= 10;

}

// palindrome if orignalN and reversedN are equal

if (originalN == reversedN)

printf("%d is a palindrome.", originalN);

else

printf("%d is not a palindrome.", originalN);

return 0;

}

Output

Enter an integer: 1001

1001 is a palindrome.

Here, the user is asked to enter an integer. The number is stored in variable n.

Similar questions